Crash on save load (corrupted save?)

Describe your experience with the latest version of FreeOrion to help us improve it.

Moderators: Oberlus, Oberlus

Forum rules
Always mention the exact version of FreeOrion you are testing.

When reporting an issue regarding the AI, if possible provide the relevant AI log file and a save game file that demonstrates the issue.
Post Reply
Message
Author
User avatar
swaq
Space Floater
Posts: 48
Joined: Tue Aug 20, 2019 1:56 pm

Crash on save load (corrupted save?)

#1 Post by swaq » Tue Aug 20, 2019 2:17 pm

I recently started playing FreeOrion and have slowly been working my way up in difficulty. In my latest game against Aggressive AI I reached a point around turn 350-370 or so where the game seemed to start behaving weird. Then when I tried to load a save past that point the game crashes.

I am playing v0.4.8+ installed from Arch Linux's AUR (freeorion-git). It says the installed version is r18009.9924d0f79-1.

Specific weirdness I can recall is Industry/Research instantly going to 0 (even though it was doing stuff), I think the AI stopped building/moving, and then later when Industry/Research was restored I was able to queue up buildings/ships well past my Industry capacity and they all still were allocated points.

Also in the early game there was a neutral planet with a stealth of 65536 (a very suspicious number for a programmer), but I don't know if this was related. Is that normal? Later in the game I was able to see this planet.

For this game I have saves at turns 3, 98, 189, 212, 270, 282, 331 (last one that loads successfully), 376, and 381. I attached the ones for turns 3, 331, and 381. I also attached a couple screenshots.

Thoughts?
Attachments
freeorion_stockpile.png
freeorion_stockpile.png (931.07 KiB) Viewed 7668 times

User avatar
Oberlus
Cosmic Dragon
Posts: 1497
Joined: Mon Apr 10, 2017 4:25 pm

Re: Crash on save load (corrupted save?)

#2 Post by Oberlus » Tue Aug 20, 2019 2:44 pm

Welcome to the forums, swaq.

I'm just another player. Your problems are maybe related to RAM shortage, if the game is too "big". How many star systems has this game and how big are the problematic save files? They failed to be uploaded in your post.

The 65k stealth is ok, It means "stealther than what you can see".
Pleasepleaseplease, join fifth multiplayer slow game!

User avatar
swaq
Space Floater
Posts: 48
Joined: Tue Aug 20, 2019 1:56 pm

Re: Crash on save load (corrupted save?)

#3 Post by swaq » Tue Aug 20, 2019 2:54 pm

Thanks for the reply. The biggest save file is 7.3 MB. I had a previous game that got up to 9.6 MB without issue. I had 110 systems and 4 AI in this game. I have 16 GB of RAM on this computer.

I don't know why all the attachments didn't go through. They showed up during the preview. I'll try again on this post, just a single save file.
Attachments
turn381.zip
(4.86 MiB) Downloaded 64 times

Morlic
AI Contributor
Posts: 281
Joined: Tue Feb 17, 2015 11:54 am

Re: Crash on save load (corrupted save?)

#4 Post by Morlic » Tue Aug 20, 2019 5:32 pm

Crashes for me as well.

Server log:

Code: Select all

19:19:41.897680 {0x00002fa0} [debug] FSM : ServerFSM.cpp:2139 : WaitingForSPGameJoiners::react(const CheckStartConditions& u) : have all 5 expected players connected.
19:19:41.897680 {0x00002fa0} [debug] FSM : ServerFSM.cpp:2152 : Loading SP game save file: C:/Users/xxx/AppData/Roaming/FreeOrion/save/Aggressive-20190819_234842.sav
19:19:41.898680 {0x00002fa0} [debug] server : Universe.cpp:161 : Reset id allocators with highest object id = -1 and highest design id = -1
19:19:41.898680 {0x00002fa0} [debug] server : SaveLoad.cpp:363 : Reading XML iarchive
19:19:41.899681 {0x00002fa0} [debug] server : SaveLoad.cpp:388 : Allocating buffers for XML deserialization...
19:19:41.899681 {0x00002fa0} [debug] server : SaveLoad.cpp:392 : Based on header info for uncompressed state string, attempting to reserve: 193737512 bytes
19:19:41.900681 {0x00002fa0} [debug] server : SaveLoad.cpp:398 : Based on header info for compressed state string, attempting to reserve: 7648872 bytes
... (parsing stuff) ...
19:19:43.775104 {0x00002fa0} [error] server : SaveLoad.cpp:446 : LoadGame(...) failed!  Error: input stream error
19:19:43.775104 {0x00002fa0} [debug] timer : ScopedTimer.cpp:34 : LoadGame: C:/Users/xxx/AppData/Roaming/FreeOrion/save/Aggressive-20190819_234842.sav time:     1877 ms
19:19:43.775104 {0x00002fa0} [debug] server : ServerApp.cpp:1228 : ServerApp::LoadGameInit
... (game rule stuff) ...
19:19:43.777105 {0x00002fa0} [error] server : ServerApp.cpp:1336 : ServerApp::LoadGameInit couldn't find empire with id 1 to add to turn processing
19:19:43.777105 {0x00002fa0} [error] server : ServerApp.cpp:1336 : ServerApp::LoadGameInit couldn't find empire with id 2 to add to turn processing
19:19:43.777105 {0x00002fa0} [error] server : ServerApp.cpp:1336 : ServerApp::LoadGameInit couldn't find empire with id 3 to add to turn processing
19:19:43.777105 {0x00002fa0} [error] server : ServerApp.cpp:1336 : ServerApp::LoadGameInit couldn't find empire with id 4 to add to turn processing
19:19:43.777105 {0x00002fa0} [error] server : ServerApp.cpp:1336 : ServerApp::LoadGameInit couldn't find empire with id 5 to add to turn processing
19:19:43.777105 {0x00002fa0} [debug] server : ServerApp.cpp:1571 : ServerApp::GetPlayerInfoMap: Compiling PlayerInfo for each player
19:19:43.777105 {0x00002fa0} [debug] server : ServerApp.cpp:1350 : ServerApp::CommonGameInit: Sending GameStartMessages to players
19:19:43.778105 {0x00002fa0} [debug] server : SerializeUniverse.cpp:65 : Universe::serialize : Getting gamestate data
19:19:43.778105 {0x00002fa0} [debug] server : Universe.cpp:3045 : GetEmpireKnownObjectsToSerialize
19:19:43.778105 {0x00002fa0} [debug] server : SerializeUniverse.cpp:84 : Universe::serialize : serializing universe width: 1000
19:19:43.778105 {0x00002fa0} [debug] server : SerializeUniverse.cpp:89 : Universe::serialize : serializing 0 ship designs
19:19:43.778105 {0x00002fa0} [debug] server : SerializeUniverse.cpp:98 : Universe::serialize : serializing empire object visibility for 0, 0, 0, 0 empires
19:19:43.778105 {0x00002fa0} [debug] server : SerializeUniverse.cpp:113 : Universe::serialize : serializing 0 objects
19:19:43.778105 {0x00002fa0} [debug] server : SerializeUniverse.cpp:119 : Universe::serialize : serializing 0 destroyed object ids
19:19:43.778105 {0x00002fa0} [debug] server : SerializeUniverse.cpp:126 : Universe::serialize : serializing empire known objects for 0 empires
19:19:43.778105 {0x00002fa0} [debug] server : SerializeUniverse.cpp:132 : Universe::serialize : serializing id allocator version = 1
19:19:43.778105 {0x00002fa0} [debug] IDallocator : IDAllocator.cpp:288 : Serialize IDAllocator()  server id = -1 empire id = 1
19:19:43.778105 {0x00002fa0} [error] server : IDAllocator.cpp:336 : Attempt to serialize allocator for an empire_id 1 not in id manager table.
19:19:43.778105 {0x00002fa0} [debug] IDallocator : IDAllocator.cpp:346 : Serialized []
19:19:43.778105 {0x00002fa0} [debug] IDallocator : IDAllocator.cpp:288 : Serialize IDAllocator()  server id = -1 empire id = 1
19:19:43.778105 {0x00002fa0} [error] server : IDAllocator.cpp:336 : Attempt to serialize allocator for an empire_id 1 not in id manager table.
19:19:43.778105 {0x00002fa0} [debug] IDallocator : IDAllocator.cpp:346 : Serialized []
19:19:43.778105 {0x00002fa0} [debug] server : SerializeUniverse.cpp:161 : Universe::serialize : serializing 0 types of statistic
19:19:43.778105 {0x00002fa0} [debug] server : SerializeUniverse.cpp:164 : Universe::serialize : serializing done
19:19:43.778105 {0x00002fa0} [debug] server : SerializeUniverse.cpp:167 : Universe::serialize : Cleaning up temporary data
19:19:43.778105 {0x00002fa0} [debug] server : SerializeUniverse.cpp:184 : Universe::serialize done
... (similar stuff for remaining players) ...
19:19:45.305449 {0x00002fa0} [debug] FSM : ServerFSM.cpp:305 : ServerFSM::HandleNonLobbyDisconnection : Lost connection to player #1, named "swaq".
Errors only in freeorion.log:

Code: Select all

19:19:45.300448 {0x00002064} [error] client : DesignWnd.cpp:1106 : Unable to initialize ShipDesignManager because empire id, 1, is invalid
19:19:45.300448 {0x00002064} [error] client : DesignWnd.cpp:881 : DisplayedShipDesignManager::Load design with id = 156 has an obsolete_ui_event_count = 81 which does not satisfy 0 < obsolete_ui_event_count < m_obsolete_ui_event_count = 81
19:19:45.308450 {0x00002ec0} [error] network : ClientNetworking.cpp:514 : ClientNetworking::NetworkingThread() : Networking thread will be terminated due to unhandled exception error #10058 "Eine Anforderung zum Senden oder Empfangen von Daten wurde verhindert, da der Socket in diese Richtung bereits durch einen vorangegangenen shutdown-Aufruf heruntergefahren worden war"
19:19:45.354423 {0x00002064} [error] client : chmain.cpp:308 : main() caught exception(std::runtime_error): Invalid empire ID specified for order.
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
swaq
Space Floater
Posts: 48
Joined: Tue Aug 20, 2019 1:56 pm

Re: Crash on save load (corrupted save?)

#5 Post by swaq » Wed Aug 21, 2019 1:30 pm

Thanks for verifying that, Morlic.

I spent a little time yesterday using the previous working save to see if I could replicate the behavior but no luck.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12458
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Crash on save load (corrupted save?)

#6 Post by Geoff the Medio » Thu Aug 22, 2019 9:59 pm

The crashing is occurring when the server is deserializing the XML empire production queue data. I think the problem is that the expected new production stockpile amount for the first serialize empire is encoded as "<m_expected_new_stockpile_amount>-nan</m_expected_new_stockpile_amount>". That "-nan" looks suspiscious.

Googling a bit, it seems plausible that this could be a problem: https://stackoverflow.com/questions/286 ... an-and-inf

Basically, you can output a "not a number" value as text, but can't read it back into a number as a value.

I have no idea why there woudl be a "nan" value in memory, though...

Regardless, I added a filter to replace all instances of ">-nan</" with ">0.000000000e+00</" in the save text before deserializing. With that done, I can load the save file, and resave it. There were actually multiple instances of -nan where numbers should have been in the save serialized text, so there might be some weird issues as a result of that, but the modified save should be loadable and playable.
Aggressive-20190819_234842_nanfiltered.zip
save after load-filter-and-resave
(4.8 MiB) Downloaded 80 times

User avatar
swaq
Space Floater
Posts: 48
Joined: Tue Aug 20, 2019 1:56 pm

Re: Crash on save load (corrupted save?)

#7 Post by swaq » Fri Aug 23, 2019 1:12 am

Hmm, yeah, that certainly does seem like it would be a problem. I wish I knew exactly what I did so I could be more helpful.

The modified save file loads without crashing but no systems show up for me... I was steamrolling the AI anyway so I wasn't really needing the save to be restored (game was essentially over already). I was just hoping the save file could provide some clues as to what went wrong.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12458
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Crash on save load (corrupted save?)

#8 Post by Geoff the Medio » Fri Aug 23, 2019 7:58 am

swaq wrote:
Fri Aug 23, 2019 1:12 am
Hmm, yeah, that certainly does seem like it would be a problem. I wish I knew exactly what I did so I could be more helpful.
I doubt it was due (directly) to something you did. It looked like random numbers in the gamestate were replaced with NaN somehow.
The modified save file loads without crashing but no systems show up for me...
It loaded OK for me, so you might need the latest or next forthcoming test build to load the save due to some unrelated save format tweaks that are possibly not compatible with older versions of FreeOrion.

User avatar
swaq
Space Floater
Posts: 48
Joined: Tue Aug 20, 2019 1:56 pm

Re: Crash on save load (corrupted save?)

#9 Post by swaq » Fri Aug 23, 2019 4:04 pm

Geoff the Medio wrote:
Fri Aug 23, 2019 7:58 am
swaq wrote:
Fri Aug 23, 2019 1:12 am
Hmm, yeah, that certainly does seem like it would be a problem. I wish I knew exactly what I did so I could be more helpful.
I doubt it was due (directly) to something you did. It looked like random numbers in the gamestate were replaced with NaN somehow.
The modified save file loads without crashing but no systems show up for me...
It loaded OK for me, so you might need the latest or next forthcoming test build to load the save due to some unrelated save format tweaks that are possibly not compatible with older versions of FreeOrion.
Okay, thanks. I compiled the latest version from git and was able to load the save file.

H2L
Space Krill
Posts: 4
Joined: Sun Sep 01, 2019 4:11 am

Re: Crash on save load (corrupted save?)

#10 Post by H2L » Sun Sep 01, 2019 5:31 am

hi, this happened to me as well, the menuing system uses an atypical save game methodology. This occurs with incomplete savegames. My workaraound to prevent this is to click the turn advance button and wait for the game to update before logging out then when I reload I log to the previous, actually played turn/ its reproduceable, if you browse into your save game folder outside the game you might find some saves are zero bytes long others that should be 5k are 3k in size etc.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12458
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Crash on save load (corrupted save?)

#11 Post by Geoff the Medio » Sun Sep 01, 2019 1:02 pm

H2L wrote:
Sun Sep 01, 2019 5:31 am
This occurs with incomplete savegames.
By "This", do you mean the specific issue with -nan appearing in save files, or something else that produces an unloadable save?
the menuing system uses an atypical save game methodology. This occurs with incomplete savegames.
Your issue apparently has to do with interrupting saves before they are complete? What version are you playing? v0.4.8 and later have dialog that pops up indicating when saves are ongoing when resigning or exiting the program.

H2L
Space Krill
Posts: 4
Joined: Sun Sep 01, 2019 4:11 am

Re: Crash on save load (corrupted save?)

#12 Post by H2L » Fri Sep 06, 2019 1:28 am

when i exit a game it ALWAYS says saves are ongoing, even when i have been away from the PC for hours, but its no biggie, as i said, i have a workaround that forces a comit. After the last turn loads, i just crash the game as its quicker and i dont need that save

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12458
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Crash on save load (corrupted save?)

#13 Post by Geoff the Medio » Sat Sep 07, 2019 10:06 am

H2L wrote:
Fri Sep 06, 2019 1:28 am
when i exit a game it ALWAYS says saves are ongoing, even when i have been away from the PC for hours, but its no biggie, as i said, i have a workaround that forces a comit. After the last turn loads, i just crash the game as its quicker and i dont need that save
The meaning of this is unclear. Do you refer to the popup that says a save is ongoing whenever you close the program? This is expected, as it explicitly starts a new every time you exit while playing a turn, regardless of how long it's been sitting waiting for input before you initiate the exit by resigning or closing the game window. The popup also allows you to exit without letting the save finish... or you can "crash" it if you prefer, though obviously this won't usually result in a loadable save file being generated. If allowed to finish, this extra save will retain any orders issued between the start of the turn and when you initiate the exit, and should be the one loaded by clicking the "continue" button on the menu splash screen when starting FreeOrion. The previous end-of-turn save is separate from that.

Post Reply