MovingBlocks / DestinationSol

Official continuation of Destination Sol, the great fun little arcade space shooter from http://sourceforge.net/projects/destinationsol/ Modules live at https://github.com/DestinationSol/
Apache License 2.0
325 stars 122 forks source link

Game crashes by fatal error: SIGSEGV (0xb) when the hero is fighting on a planet #695

Open jozefcifre opened 8 months ago

jozefcifre commented 8 months ago

What you were trying to do

To play the game.

What actually happened

A fatal error has been detected by the Java Runtime Environment: SIGSEGV (0xb) at pc=0x00007f0911021679, pid=20165, tid=20176

It has happened about 3 times, when the ship is about to die by gunfire from around 20 ships at the same time.

How to reproduce

Game version

2.1.0 (develop)

Log details

ds-coredump-nov9.txt

hs_err_pid20165.log

ds-coredump-nov8.txt

hs_err_pid43915.log

Operating System

Linux

Additional Info

Distro: NixOS

BenjaminAmos commented 7 months ago

I have clearly not tested 9 systems in a while. Going to a hard planet renders the game unplayable (roughly 1 frame every 20 seconds) but it doesn't crash for me.

Current thread (0x00007f093c019000):  JavaThread "main" [_thread_in_native, id=20176, stack(0x00007f0968300000,0x00007f0968400000)]

Stack: [0x00007f0968300000,0x00007f0968400000],  sp=0x00007f09683fd8e0,  free space=1014k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [libgdx-box2d64.so+0x21679]  b2BlockAllocator::Allocate(int)+0x49

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
J 7147  com.badlogic.gdx.physics.box2d.World.jniCreateBody(JIFFFFFFFFZZZZZF)J (0 bytes) @ 0x00007f092c827299 [0x00007f092c827240+0x0000000000000059]
J 7146 c1 com.badlogic.gdx.physics.box2d.World.createBody(Lcom/badlogic/gdx/physics/box2d/BodyDef;)Lcom/badlogic/gdx/physics/box2d/Body; (120 bytes) @ 0x00007f0925bb13d4 [0x00007f0925bb12c0+0x0000000000000114]
J 8336 c1 org.destinationsol.game.item.LootBuilder.buildBody(Lorg/destinationsol/game/SolGame;Lcom/badlogic/gdx/math/Vector2;F)Lcom/badlogic/gdx/physics/box2d/Body; (97 bytes) @ 0x00007f092517eacc [0x00007f092517e8a0+0x000000000000022c]
J 8335 c1 org.destinationsol.game.item.LootBuilder.build(Lorg/destinationsol/game/SolGame;Lcom/badlogic/gdx/math/Vector2;Lorg/destinationsol/game/item/SolItem;Lcom/badlogic/gdx/math/Vector2;IFLorg/destinationsol/game/ship/SolShip;)Lorg/destinationsol/game/item/Loot; (164 bytes) @ 0x00007f09251d3664 [0x00007f09251d2d40+0x0000000000000924]
J 8339 c1 org.destinationsol.game.ship.SolShip.throwLoot(Lorg/destinationsol/game/SolGame;Lorg/destinationsol/game/item/SolItem;Z)V (186 bytes) @ 0x00007f09251caffc [0x00007f09251ca520+0x0000000000000adc]
j  org.destinationsol.game.ship.SolShip.throwAllLoot(Lorg/destinationsol/game/SolGame;)V+262
J 8119 c1 org.destinationsol.game.ship.SolShip.onRemove(Lorg/destinationsol/game/SolGame;)V (96 bytes) @ 0x00007f0925e00ed4 [0x00007f0925e00cc0+0x0000000000000214]
J 7934 c2 org.destinationsol.game.ObjectManager.removeObjNow(Lorg/destinationsol/game/SolGame;Lorg/destinationsol/game/SolObject;)V (36 bytes) @ 0x00007f092ca398a4 [0x00007f092ca39560+0x0000000000000344]
J 6693 c2 org.destinationsol.game.ObjectManager.update(Lorg/destinationsol/game/SolGame;F)V (459 bytes) @ 0x00007f092c707994 [0x00007f092c706a60+0x0000000000000f34]
J 6898 c2 org.destinationsol.SolApplication.render()V (140 bytes) @ 0x00007f092c7ab53c [0x00007f092c7aa520+0x000000000000101c]
J 6903 c2 com.badlogic.gdx.backends.lwjgl3.Lwjgl3Window.update()Z (217 bytes) @ 0x00007f092c7b27b0 [0x00007f092c7b2300+0x00000000000004b0]
J 8304% c1 com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.loop()V (468 bytes) @ 0x00007f09254135d4 [0x00007f0925412cc0+0x0000000000000914]
j  com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.<init>(Lcom/badlogic/gdx/ApplicationListener;Lcom/badlogic/gdx/backends/lwjgl3/Lwjgl3ApplicationConfiguration;)V+243
j  org.destinationsol.desktop.SolDesktop.main([Ljava/lang/String;)V+258
v  ~StubRoutines::call_stub

What is happening here is that the application crashes somewhere in the b2BlockAllocator::Allocate(int) method, which is a part of the native Box2D library. We use Box2D for physics via libGDX's gdx-box2d wrapper. On our side, the game crashes from somewhere within the method LootBuilder.buildBody(SolGame, Vector2, float). Strictly speaking, the crash occurs in native code (meaning, outside of the JVM's control), which is invoked from the com.badlogic.gdx.physics.box2d.World.jniCreateBody method.

My guess is that either your machine is running out of memory because of the extreme quantities of ships, projectiles and "loot" present, or a bug caused an absurd quantity of memory to be requested in one go (which would call malloc instead). Either way, diagnosing a native crash could take some time. The java crash logs you provided are proving very useful.

jozefcifre commented 7 months ago

My guess is that either your machine is running out of memory because of the extreme quantities of ships, projectiles and "loot" present, or a bug caused an absurd quantity of memory to be requested in one go (which would call malloc instead). Either way, diagnosing a native crash could take some time. The java crash logs you provided are proving very useful.

I think so. Here are the console logs:

logs-ds-core-dumped-nov8.txt

logs-ds-core-dumped-nov9.txt