pioneerspacesim / pioneer

A game of lonely space adventure
https://pioneerspacesim.net
1.64k stars 380 forks source link

Game crashes when looking at certain stars, e.g. Type 'M' red stars #4670

Closed wingnut-2019 closed 4 years ago

wingnut-2019 commented 5 years ago

Observed behaviour

Game crashes when certain types of stars become visible. As of now I observed it for Type 'M' red stars and sometimes Brown dwarfs

Expected behaviour

Game should not crash

Steps to reproduce

  1. Select the "Start on Mars" option in the main menu
  2. Go to the Sector map and select the hyperjump target to Kruger 60 A (-1, -1, 1)
  3. Request launch on Mars and initiate the hyperjump to Kruger 60 A
  4. Select Kruger 60 A as navigation target and orient the ship so that Kruger 60 A is visible -> once the star becomes visible the game crashes immediately

I have included a savegame just after arriving in the Kruger 60 system. The issue might not be reproducible (easily) on other machines as I could not find a similar issue loged already.

My pioneer version (and OS): pioneer-20190203 on Windows 10

Attachments

Kruger 60 A.zip (Savegame) opengl.txt output.txt (output.txt after provoking the game crash with above savegame)

craigo- commented 5 years ago

I cannot reproduce the crash, either with your steps or your savegame. (I can, however, quite happily crash my ship into that sun :smile:)

My environment:

pcercuei commented 5 years ago
Thread 1 "pioneer" received signal SIGSEGV, Segmentation fault.

#0  Graphics::VertexArray::Clear (this=0x0) at ../src/graphics/VertexArray.cpp:34
#1  0x00005555557aa366 in HyperspaceCloud::Render (this=0x5555642f6bc0, renderer=0x555555e2a720, viewCoords=..., viewTransform=..., camera=<optimized out>)
    at /usr/include/c++/9/bits/unique_ptr.h:352
#2  0x00005555557706b7 in Camera::Draw (this=0x5555569f8c70, excludeBody=0x0, cockpit=0x0) at ../src/Camera.cpp:260
#3  0x0000555555698a21 in WorldView::Draw3D (this=0x55555659e640) at /usr/include/c++/9/bits/unique_ptr.h:352
#4  0x0000555555607802 in Pi::MainLoop () at ../src/WorldView.h:78
#5  0x0000555555607dc8 in Pi::Start (startPath=...) at ../src/Pi.cpp:1300
#6  0x00005555555e7848 in main (argc=<optimized out>, argv=<optimized out>) at ../src/main.cpp:181 
impaktor commented 5 years ago

@pcercuei great with backtrace! :+1: Is this current master / which commit is your pioneer on?

pcercuei commented 5 years ago

That's commit f508f0047 (I believe it's the latest master), running on Linux.

impaktor commented 5 years ago

Maybe it's not the star that crashes the game, but the hypercloud, if I'm guessing on the backtrace? (I haven't looked at the code, just riffing). @wingnut-2019 :point_up:

pcercuei commented 5 years ago

Maybe it's a different bug too :) The only thing I did was to load the savestate, and press twice on F1.

mike-f1 commented 5 years ago

Maybe it's a different bug too :)

...got the same: if it's not a copy-paste problem, in attached file "output.txt" the last printed line is

num =

which is called in Background.cpp:

https://github.com/pioneerspacesim/pioneer/blob/f508f0047a2ead557898aad6220afb31b490099c/src/Background.cpp#L305

(it has changed due to PR's)

In same file there's also a (strange?) text:

Loading saved game 'save3' failed: wrong save file version.
Game::LoadGame('Kruger 60 A')

which can or cannot be related to the crash.

wingnut-2019 commented 5 years ago

Thanks for your investigations.

The line Loading saved game 'save3' failed: wrong save file version.

relates to a savegame from the previous pioneer release I used (pioneer-20180203-win32). The issue also was occuring in that version by the way. I removed all savegames from previous releases, then loaded the savegame from the first post and the game crashes again when I reorient the ship towards the star.

I can't really tell from my end whether the game crashes due to the star or some hperclouds in it's vicinity.

Find attached output.txt and opengl.txt from after this crash: opengl.txt output.txt

sturnclaw commented 5 years ago

I've tracked down the hypercloud bug; the InitGraphics method is not being called when it's loaded from a savefile, triggering a segfault here: https://github.com/pioneerspacesim/pioneer/blob/f508f0047a2ead557898aad6220afb31b490099c/src/HyperspaceCloud.cpp#L173

This doesn't appear to be the root cause of the problem, but adding InitGraphics() to the end of the JSON constructor should fix this specific crash.

impaktor commented 5 years ago

@Web-eWorks will you PR that?

sturnclaw commented 5 years ago

@impaktor Sure, can do. I'll get that tested and PR'd in a few minutes.

sturnclaw commented 5 years ago

@wingnut-2019 I've created a PR (#4672) to resolve the hyperspace cloud crash bug; if you could pull that and test to see if the game still crashes for you? I cannot reproduce the bug you're describing, which makes me think it's related to your specific graphics configuration.

For reference, this is what Kruger 60 A looks like for me: Screenshot from 2019-09-14 12-37-24

impaktor commented 5 years ago

Hypercloud fix now merged, thanks @Web-eWorks!

Could those who replicated the bug try to do so again, with a fresh backtrace? ping: @pcercuei or @wingnut-2019

sturnclaw commented 4 years ago

@wingnut-2019 if you're still interested in helping to reproduce this bug, please run the game via GDB (Gnu De-Bugger) and give us a callstack from the crash - at the moment, none of us are able to reproduce this specific crash, and it appears your crash is an unrelated threading issue given how the output log cuts off halfway through a syscall function.

Closing this as stale; we've fixed the only bug we could reproduce.