Fractal Softworks Forum

Please login or register.

Login with username, password and session length

Author Topic: [0.8.1a RC8] occasional hang while saving modded game  (Read 5765 times)

LoweN

  • Ensign
  • *
  • Posts: 11
    • View Profile
[0.8.1a RC8] occasional hang while saving modded game
« on: June 07, 2017, 11:22:27 AM »

Not sure what mod/mods are doing it. I increased my vmparams to -Xms1536m -Xmx4096m -Xss1024k so I don't think it's memory, but who knows. I have 6gb of memory on this system.

I've snipped some noninformative stuff from the log and replaced it with ...

2277793 [Thread-4] INFO  com.fs.starfarer.campaign.save.CampaignGameManager  - Saving to ..\\saves/save_FaYingDeimos_1690678237848135608...
2277794 [Thread-4] INFO  com.fs.starfarer.campaign.save.CampaignGameManager  - Saving stage 1
2277830 [Thread-15] INFO  com.fs.starfarer.campaign.save.CampaignGameManager  - Saving progress: 0.0
...
2279424 [Thread-15] INFO  com.fs.starfarer.campaign.save.CampaignGameManager  - Saving progress: 0.0
2279431 [Thread-4] INFO  com.fs.starfarer.campaign.save.CampaignGameManager  - Saving stage 2
2280142 [Thread-15] INFO  com.fs.starfarer.campaign.save.CampaignGameManager  - Saving progress: 0.0
...
2280185 [Thread-15] INFO  com.fs.starfarer.campaign.save.CampaignGameManager  - Saving progress: 0.0
2280201 [Thread-15] INFO  com.fs.starfarer.campaign.save.CampaignGameManager  - Saving progress: 0.0018263967

...

2284724 [Thread-15] INFO  com.fs.starfarer.campaign.save.CampaignGameManager  - Saving progress: 0.36288723
2284740 [Thread-4] INFO  com.fs.starfarer.campaign.save.CampaignGameManager  - Error saving game
2284741 [Thread-15] INFO  com.fs.starfarer.campaign.save.CampaignGameManager  - Saving progress: 0.36288723

...

2285324 [Thread-15] INFO  com.fs.starfarer.campaign.save.CampaignGameManager  - Saving progress: 0.36288723
2285331 [Thread-4] ERROR com.fs.starfarer.campaign.save.CampaignGameManager  -
java.util.ConcurrentModificationException
   at java.util.HashMap$HashIterator.nextEntry(Unknown Source)
   at java.util.HashMap$EntryIterator.next(Unknown Source)
   at java.util.HashMap$EntryIterator.next(Unknown Source)
   at com.thoughtworks.xstream.converters.collections.MapConverter.marshal(MapConverter.java:75)
   at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
   at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
   at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
   at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.mars hallField(AbstractReflectionConverter.java:256)
   at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:232)
   at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.<init>(AbstractReflectionConverter.java:195)
   at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMa rshal(AbstractReflectionConverter.java:141)
   at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.mars hal(AbstractReflectionConverter.java:89)
   at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
   at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
   at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)

... lots more like this

   at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMa rshal(AbstractReflectionConverter.java:141)
   at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.mars hal(AbstractReflectionConverter.java:89)
   at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
   at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
   at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
   at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:88)
   at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.wri teItem(AbstractCollectionConverter.java:64)
   at com.thoughtworks.xstream.converters.collections.CollectionConverter.marshal(CollectionConverter.java:74)
2285341 [Thread-15] INFO  com.fs.starfarer.campaign.save.CampaignGameManager  - Saving progress: 0.36288723
2285371 [Thread-4] INFO  com.fs.starfarer.campaign.save.CampaignGameManager  - Loading stage 9 (exception)
2285371 [Thread-4] INFO  com.fs.starfarer.campaign.save.CampaignGameManager  - Loading stage 10 (exception)
2285381 [Thread-15] INFO  com.fs.starfarer.campaign.save.CampaignGameManager  - Saving progress: 0.0

... then saving progress 0.0 forever, and I need to manually end the task.
modlist:
lightshow without ship and weapon pack 1.32
autosave 1.0f
combat chatter 1.7.1
common radar 2.4c
console commands 3.0 wip 2
lazylib 2.2
Nexerelin 0.8b
omnifactory 2.1.4 (the reboot)
portrait pack v1.2.3
save transfer 1.11.0
tore up plenty 0.8.0a
unknown skies 0.21
upgraded rotary weapons 1.31
version checker 1.7c
zz graphicslib 1.2.0

I played a nexerelin game without any other mods except lazylib for an hour or so to see if I could trigger it but didn't get anything.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24125
    • View Profile
Re: [0.8.1a RC8] occasional hang while saving modded game
« Reply #1 on: June 07, 2017, 12:30:05 PM »

There should be another exception - probably above this line:
java.util.ConcurrentModificationException

That might have more information about what went wrong. Basically, you're looking for a related stack trace but one that has something with "com.fs.starfarer" in it.
Logged

LoweN

  • Ensign
  • *
  • Posts: 11
    • View Profile
Re: [0.8.1a RC8] occasional hang while saving modded game
« Reply #2 on: June 08, 2017, 01:08:14 PM »

There should be another exception - probably above this line:
java.util.ConcurrentModificationException

That might have more information about what went wrong. Basically, you're looking for a related stack trace but one that has something with "com.fs.starfarer" in it.

I don't see anything like that. I took everything from that play session (launcher, load game, to hang) and put it in its own starsector.log, but it's still 2.5mb, too big for pastebin. If anyone wants to take a look they should be able to read this google drive link:

starsector.log

(edit - this is an old issue I haven't seen in years, so I've deleted the above log from my google drive.)
« Last Edit: October 13, 2021, 01:13:14 PM by LoweN »
Logged

Hussar

  • Captain
  • ****
  • Posts: 265
    • View Profile
Re: [0.8.1a RC8] occasional hang while saving modded game
« Reply #3 on: June 08, 2017, 03:27:05 PM »

Not really having a log Alex, but I also experienced occasional freezes while saving (I have also increased vprams, quite substainally - 4gb to 12gb). I have noticed however they ONLY happened to me while QUICKSAVING.

I'll try to remember and if the game freezes again I'll snag you the log.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24125
    • View Profile
Re: [0.8.1a RC8] occasional hang while saving modded game
« Reply #4 on: June 08, 2017, 03:33:57 PM »

I'd suggest keeping min/max memory settings the same. 12g is excessive, also, I'd suggest 6g/6g as the maximum.

@Lowen: huh, weird, that's a really strange one. You're right, that's the only relevant bit in the log. If you can somehow get it to happen reliably (tough given that it happens during saving!), I'd love to take a look.
Logged

Hussar

  • Captain
  • ****
  • Posts: 265
    • View Profile
Re: [0.8.1a RC8] occasional hang while saving modded game
« Reply #5 on: June 08, 2017, 03:37:44 PM »

Well, my system can handle it so hence why. But I'll check will 6-6 gonna be better, thanks :)

Oh, one more thing I remembered (hopefully it helps). When it happens on a quicksave - the game freezes on 'saving the backup' file. Guess it's the saving grace of the whole problem because killing the game doesn't mess up the save. I can continue the game from the last successful save.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24125
    • View Profile
Re: [0.8.1a RC8] occasional hang while saving modded game
« Reply #6 on: June 09, 2017, 08:48:31 AM »

Was thinking about this, and where to look for any likely culprits. The xstream code where it throws the exception is here:

https://github.com/x-stream/xstream/blob/master/xstream/src/java/com/thoughtworks/xstream/converters/collections/MapConverter.java

What's most likely going on is it's going through a Map the game uses to keep track of... something and writing it out to XML. And then in the process, the map gets modified and so the exception is thrown.

Just from looking at that code, the only way that seems like it could possibly happen is if a mod (or, I suppose, vanilla, but it hasn't been reported with vanilla) has a writeReplace() method that causes this kind of modification to happen.

Another possibility is another thread modifying the map (whatever it happens to be) while the saving process is going on. That'd be a bad idea for various other reasons, as the core code is not thread-safe, so it seem far-fetched that someone would do it, but wanted to mention it for completeness' sake.
Logged

Dark.Revenant

  • Admiral
  • *****
  • Posts: 2806
    • View Profile
    • Sc2Mafia
Re: [0.8.1a RC8] occasional hang while saving modded game
« Reply #7 on: June 09, 2017, 09:01:57 AM »

The only mod I know of that actually uses a separate thread to interface with the game is SWP... which he doesn't have enabled.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24125
    • View Profile
Re: [0.8.1a RC8] occasional hang while saving modded game
« Reply #8 on: June 09, 2017, 09:43:36 AM »

Ah - good to more or less rule that out, then.
Logged

gruberscomplete

  • Captain
  • ****
  • Posts: 253
    • View Profile
Re: [0.8.1a RC8] occasional hang while saving modded game
« Reply #9 on: December 08, 2017, 09:41:04 AM »

So you still haven't found a solution to this issue? This has been bugging all of my saves really badly
Logged
Click here for FREE ships!               Plentysector               Robots With Souls

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24125
    • View Profile
Logged

gruberscomplete

  • Captain
  • ****
  • Posts: 253
    • View Profile
Re: [0.8.1a RC8] occasional hang while saving modded game
« Reply #11 on: December 08, 2017, 10:04:31 AM »

I tried that already but it still crashes.
Logged
Click here for FREE ships!               Plentysector               Robots With Souls

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24125
    • View Profile
Re: [0.8.1a RC8] occasional hang while saving modded game
« Reply #12 on: December 08, 2017, 10:23:08 AM »

Hmm. So this is either a bug with xstream (the library Starsector uses to generate savefiles; this would be bad) or a bug with one of the mods. I haven't seen it reported with vanilla, and haven't seen it happen in my own testing, but it's possible that mods make the crash happen by just increasing the load rather than doing something directly crash-inducing.

It might be good to post your mod list, just to see if anyone has ideas. (The thing I would look for is any "writeReplace()" methods in mod source, but I'm not sure that all mods come with their source, so trying to hunt for that could be a bit rough.)

Another thing to try would be disabling some of the mods to try to narrow it down, although that may be troublesome depending on how reproducible the issue is. And it wouldn't 100% indicate a specific mod is at fault (could again be a "higher load" issue) but it would at least point at something to look more closely at.

Basically, the more info, the better. Along those lines, it'd be good to see your crash log as well, just to make sure it's actually the same issue, and not something subtly different.
Logged