briansd9 / starsector-fleethistory

0 stars 1 forks source link

Mod's possible connection to save loading failure #1

Closed Histidine91 closed 3 years ago

Histidine91 commented 3 years ago

While debugging this issue where Starsector saves fail to load, I found something which suggests that Fleet History is involved in that bug. Specifically, I wrote an XStream converter as Alex suggests in that thread, gave it to someone reporting the issue (Discord user HospitalWaitingRoom), and got the resulting log:

138107 [Thread-3] INFO  data.scripts.PFFConverter  - Testing deserialization of class fleethistory.types.BattleRecord
138107 [Thread-3] INFO  data.scripts.PFFConverter  - Testing deserialization of class fleethistory.types.BattleRecordSideInfo
138109 [Thread-3] INFO  data.scripts.PFFConverter  - Testing deserialization of class fleethistory.types.ShipLog
138109 [Thread-3] INFO  data.scripts.PFFConverter  - Testing deserialization of class fleethistory.types.ShipInfo
138109 [Thread-3] INFO  data.scripts.PFFConverter  - Testing deserialization of class fleethistory.types.ShipLogEntry
138109 [Thread-3] INFO  data.scripts.PFFConverter  - Testing deserialization of class fleethistory.shipevents.ShipTransaction
138109 [Thread-3] INFO  data.scripts.PFFConverter  - Testing deserialization of class fleethistory.shipevents.ShipBattleRecord
138110 [Thread-3] INFO  data.scripts.PFFConverter  - Testing deserialization of class fleethistory.shipevents.ShipRecovery
138110 [Thread-3] INFO  data.scripts.PFFConverter  - Testing deserialization of class fleethistory.StringCache
138110 [Thread-3] INFO  data.scripts.PFFConverter  - Testing deserialization of class java.lang.StringBuilder
138130 [Thread-3] INFO  com.fs.starfarer.campaign.save.CampaignGameManager  - Error loading
138130 [Thread-3] ERROR com.fs.starfarer.campaign.save.CampaignGameManager  - Failed calling method

Spitballing: Is there an intel class that checks the player fleet and/or its members on deserialization? If so, perhaps not doing so until after game load (unsure how this would be done) will fix it.

briansd9 commented 3 years ago

Hmm, any stack trace following? Not sure how deserializing a StringBuilder could fail...

But the log in the linked forum thread looks almost exactly the same as the one reported to me a while back: https://fractalsoftworks.com/forum/index.php?topic=21929.msg333173#msg333173

This bug was fixed in version 1.0.6 (so older mod versions are still susceptible to this).

The root cause of the issue was FleetMemberAPI objects being saved to a HashMap in Global.getSector().getPersistentData() during combat and not properly cleaned up afterwards - if it's not an old version of my mod causing this, might be worth checking for other mods that do something similar.

Histidine91 commented 3 years ago

User's infolog lists Fleet History at version 1.0.0, so that's probably it. I'll tell 'em to update.

briansd9 commented 3 years ago

Cheers, good to know.

The save file can be fixed manually too, instructions here: https://fractalsoftworks.com/forum/index.php?topic=21929.msg334039#msg334039