pioneerspacesim / pioneer

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

Crash in specific system (reproducable) #1724

Closed Loki999 closed 10 years ago

Loki999 commented 12 years ago

Using nightly 1f6ce06

When in a certain system Caned (2,-1,7,1), after i have been in the system for several in-game hours, it crashes (screenshot: http://img545.imageshack.us/img545/8224/crashl.png)

Savegame located here: http://dl.dropbox.com/u/29921927/nightly3

Tried with Alpha 28 but save game incompatibility prevented. Worth testing with new game in same system using Alpha 28 or 27.

Tried multiple things, flying to system via another system, flying towards one starbase or another, or even just sitting idle on manual and doing nothing.

Had my more trade ships mod installed, but restored original Lua file and problem still occurred.

Loki999 commented 12 years ago

Confirmed: No problem in Alpha 28.

Semi-unrelated note, noticing a lot of trade ships giving too high gravity messages in console. Guessing these problems are all related to changes going on with atmospheres and planets at the moment.

Brianetta commented 12 years ago

@irigi You introduced this assert in 101b94dee0cea95f296eb6c1a3a4405a855f2b04 - any ideas?

robn commented 11 years ago

Tried with Alpha 28 but save game incompatibility prevented. Worth testing with new game in same system using Alpha 28 or 27.

This is a v55 (alpha 28) savefile. Alpha 27 did not even have that assert. Which version can you reproduce it with (tell me the version number from the main menu, if you can).

I'll fly out to that system and see if I can reproduce.

robn commented 11 years ago

Just spent three weeks of game time at Caned. No crash. master @39cf40c0.

Loki999 commented 11 years ago

Interesting. Did you start a new game or use my save?

I can try starting a new game, and on a different computer.

robn commented 11 years ago

Both. I loaded your save on master (roughly alpha 28) and started a new game and flew out there.

Loki999 commented 11 years ago

Good news then. Im just about to make another test myself.

Loki999 commented 11 years ago

Exactly same problem occurred. Still on same computer though as can't get on the other one for the moment. New game, different ship.

One thing left to check...

Loki999 commented 11 years ago

Ah, was thinking maybe it was related to military drives as usually have those. Tested with regular drive, problem still occurred.

Still using the same Nightly as initially reported. Can try new nightly later.

Loki999 commented 11 years ago

Version: Nightly 1f6ce06 (On different computer) New game No mods (and with MF/X-Wing extra ships) - this is interesting, ill detail in a moment.

Same crash occurred.

Now, here is the interesting part. When i had the MF and X-Wing mods installed, the crash happened within a few AU of flying to the planet, same as has happened on both computers and running different versions.

When removed, i thought i was going to make it to the planet, was just a couple of AU away, and then bang.

The MF's lua I had to mod after finding out things like weapon ports had received a change.

This could be a red herring but, has something else changed in relations to ships, and if their LUAs have not been updated, or not updated correctly, they could be causing the crash? With the extra ships installed, the crash is a lot more likely. Without them, then its only going to happen if a certain ship, whose Lua was not correctly updated, is spawned? Unforutunately, stdout.txt does not show a ship spawning just before the crash. Assert is probably raised before output is made.

Anyway, just pure conjecture on my part. Really needs a dev to be able to reproduce I think now.

irigi commented 11 years ago

Sorry for being unresponsive. I'll look at this. If the game crashes on that assert of mine, it means that the autopilot (or something else) tries to calculate the safe travel velocity with more fuel that the ship mass (which, to my knowledge shouldn't happen) or that the ship mass is zero. I will try to look at this properly tomorrow.

robn commented 11 years ago

@Loki999 Please clarify. Can you reproduce this crash with a plain, unmodded Pioneer?

Loki999 commented 11 years ago

@robn - yes, exactly. Sorry if it was not clear. Complete unmodded it still happens.

Loki999 commented 11 years ago

@irigi - Cool.

irigi commented 11 years ago

@Loki999 I tried your savefile with current master, but no crash occured under Linux 64bit. Could you please output fuel state of the ship by GetFuel() just before this assert to console, and also the GetMass(), fuelUsed and GetShipType().fuelTankMass, if possible? I'm a bit suspicious about bad restoring of fuel state from the savefile. I encountered this before and corrected in 929a0e6c by putting UpdateStats() into PostLoadFixup() in Ship.cpp, but there could still be some problem with the fuel. (But it could easily be also something else.)

Loki999 commented 11 years ago

@irigi - not easily doable. The crash happens in the system randomly, when travelling at max time, so no real way to get fuel.

All i can say is my fuel is normal, its full when i arrive in system, and not even a third depleted usually. And as i said, i've used different ships here.

I have stated this does not happen on Alpha 28 (master), only on the nightlies - my second post stated this), so its probably a problem with some code that is currently in development, and therefore something that would be best figured out before it gets slipped into the next alpha.

irigi commented 11 years ago
Not easily doable. The crash happens in the system randomly, when travelling at max time, so no real way to get fuel.

I was thinking about putting the debug printf code directly into Ship::GetVelocityReachedWithFuelUsed() before the assert which causes the crash and then sending last outputs before the crash happened.

All i can say is my fuel is normal, its full when i arrive in system, and not even a third depleted usually. And as i said, i've used different ships here.

It can easily be an AI controlled tradeship, not the player ship. This happens in the autopilot and all AI controlled ships use it.

I'm not sure how to get source of the nightly from github. Could you maybe pack it into your dropbox and send me the link to the file, please?

Loki999 commented 11 years ago

Sorry, i have no idea how to get the nightly code either (just the regular master). I'm just a player/tester who likes to tinker.

I do like to play with the nightlies though, just to test out new features that are coming.

irigi commented 11 years ago

No problem, I'll try to figure it out - maybe I just didn't spend enough flight time in the system. Current master is still very similar to that nightly, so the problem should appear eventually.

Would you please send me your mod for more ships? Since there is more of them, the crash will be much more likely to happen which will make my testing easier.

robn commented 11 years ago

The Git ref for the nightlies are always on the menu screen, and they're always based on a master branch. @1f6ce06 is the one here. git checkout 1f6ce06 will get you a working copy and then you can build it.

irigi commented 11 years ago

@robn Great, thanks!

Brianetta commented 11 years ago

The nightly's filename is pioneer-7dff708-linux32.tar.bz2, so the commit from which it was compiled was 7dff708.

You can simply check that out in Git. Oh look, Rob beat me to it.

Loki999 commented 11 years ago

@igri - you can download the current version from here: http://dl.dropbox.com/u/29921927/TradeShips.lua

That should cause the crash to happen quite quickly (once you are on speed up mode).

irigi commented 11 years ago

Great, thanks all of you!

irigi commented 11 years ago

I'm flying around the Caned system like crazy with the correct nightly, but it never crashed for me. It is probably something system-specific. (I'm running Linux 64bit.) Could somebody who develops under Windows add this:

printf("  %s %.1f %.1f %d %.1f %s\n", GetLabel().c_str(), ShipMassNow, ShipMassAfter, GetShipType().fuelTankMass, fuelUsed, GetShipType().name.c_str());
fflush(stdin);
assert(ShipMassAfter > 0 && ShipMassNow > 0); // shouldn't happen

before the assert and check if he can reproduce it? This output should show what went wrong..

Loki999 commented 11 years ago

Crazy. I've had this error on two different windows machines with new games on both. Could indeed be windows specific.

Oh, and both my machines are running 32-bit windows 7. Yeah, i really should have installed 64-bit, no idea why i didn't.

But hey, at least i'm testing backwards compatibility. Think i have a computer with XP sitting around somewhere :-D

Brianetta commented 11 years ago

Just got this on Linux 64 bit. Commit 588a1131534ab7ef74ad02471a265b09f9fb32da (master as at 18/12/2012).

Game time is less than a minute, in Sol, still landed. gdb backtrace:

#0  0x00007ffff572f425 in raise () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007ffff5732b8b in abort () from /lib/x86_64-linux-gnu/libc.so.6
#2  0x00007ffff57280ee in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#3  0x00007ffff5728192 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#4  0x0000000000519697 in Ship::GetVelocityReachedWithFuelUsed (this=<optimised out>, fuelUsed=<optimised out>)
    at /home/brian/pioneer/src/Ship.cpp:269
#5  0x000000000052274b in AICmdFlyTo::TimeStepUpdate (this=<optimised out>) at /home/brian/pioneer/src/ShipAICmd.cpp:810
#6  0x0000000000523ba2 in ProcessChild (this=<optimised out>) at /home/brian/pioneer/src/ShipAICmd.cpp:61
#7  AICmdDock::TimeStepUpdate (this=<optimised out>) at /home/brian/.ccache/tmp/ShipAICmd.tmp.motoko.3531.ii:926
#8  0x0000000000515269 in Ship::AITimeStep (this=<optimised out>, timeStep=<optimised out>)
    at /home/brian/pioneer/src/Ship-AI.cpp:90
#9  0x000000000051d4bd in Ship::StaticUpdate (this=<optimised out>, timeStep=<optimised out>)
    at /home/brian/pioneer/src/Ship.cpp:999
#10 0x000000000053fef2 in Space::TimeStep (this=<error reading variable: Unhandled dwarf expression opcode 0x0>, 
    step=<error reading variable: Unhandled dwarf expression opcode 0x0>) at /home/brian/pioneer/src/Space.cpp:745
#11 0x000000000043e5ff in Game::TimeStep (this=<optimised out>, 
    step=<error reading variable: Unhandled dwarf expression opcode 0x0>) at /home/brian/pioneer/src/Game.cpp:237
#12 0x00000000004edc15 in Pi::MainLoop () at /home/brian/pioneer/src/Pi.cpp:901
#13 0x00000000004ed6d8 in Pi::Start () at /home/brian/pioneer/src/Pi.cpp:835
#14 0x000000000040d50d in main (argc=1, argv=<optimised out>) at main.cpp:58

Last output on stdout:

LD-7473 leaves frame Mars
IF-5269 leaves frame Earth
AE-2075 AICompleted: Error: GRAV_TOO_HIGH Status: inbound
PX-9521 AICompleted: Error: GRAV_TOO_HIGH Status: inbound
VY-3203 (caribou) out of fuel
VY-3203 leaves frame System
pioneer: Ship.cpp:269: double Ship::GetVelocityReachedWithFuelUsed(float): Assertion `ShipMassAfter > 0 && ShipMassNow > 0' failed.
Program received signal SIGABRT, Aborted.
0x00007ffff572f425 in raise () from /lib/x86_64-linux-gnu/libc.so.6
impaktor commented 10 years ago

Auto pilot doesn't cause crash on any platform here in the future of 2014.