Fractal Softworks Forum

Please login or register.

Login with username, password and session length

Author Topic: ConcurrentModificationException wile traveling in Hyperspace  (Read 1251 times)

AliahMana

  • Ensign
  • *
  • Posts: 3
    • View Profile
ConcurrentModificationException wile traveling in Hyperspace
« on: March 07, 2020, 02:35:09 PM »

I have a modded save that is at cycle 227, wich i didnt have a problem with until now

Whenever i load the save and go into Hyperspace, i will CTD after about 20 - 30 seconds while traveling (just sitting around seems to be fine)

the log shows the following:

Code
111127 [Thread-4] ERROR com.fs.starfarer.combat.CombatMain  - java.util.ConcurrentModificationException
java.util.ConcurrentModificationException
at java.util.ArrayList$Itr.checkForComodification(Unknown Source)
at java.util.ArrayList$Itr.next(Unknown Source)
at com.fs.starfarer.campaign.fleet.CampaignFleet.despawn(Unknown Source)
at com.fs.starfarer.api.impl.campaign.fleets.RouteManager.spawnAndDespawn(RouteManager.java:598)
at com.fs.starfarer.api.impl.campaign.fleets.RouteManager.advance(RouteManager.java:572)
at com.fs.starfarer.api.impl.campaign.CoreScript.advance(CoreScript.java:126)
at com.fs.starfarer.campaign.CampaignEngine.advance(Unknown Source)
at com.fs.starfarer.campaign.CampaignState.advance(Unknown Source)
at com.fs.starfarer.BaseGameState.traverse(Unknown Source)
at com.fs.state.AppDriver.begin(Unknown Source)
at com.fs.starfarer.combat.CombatMain.main(Unknown Source)
at com.fs.starfarer.StarfarerLauncher$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Im running the following Mods

Adjusted Sector v0.2.2
Audio Plus 1.1.1
Autosave 1.1
Better Colonies
Blackrock Drive Yards 0.9.5a
Celestial Mount Circle 1.2
CombatChatter_1.9.2d
Commissioned.Crews
Common_Radar_2.5
Dassault-Mikoyan_Engineering_v1.18a
DIABLEAVIONICS_V2.04
DisassembleReassemble_v1.6.9
Fuel_Siphoning_1.1.3
GraphicsLib 1.4.1
Industrial.Evolution
Interstellar_Imperium_2.1.2
Junk Pirates JP_RC_340
LazyLib_2.4f
Leading Pip 1.8.3
Legacy_of_Arkgneisis
Lightshow_1.40
Luddic_Enhancement_1_2_0
MagicLib_0.28
New Beginnings 1.1.1
Nexerelin_0.9.5h
PlanetaryShieldAccessControl-1.1
Portrait pack v1.2.3
PracticeTargets_v1.30rc2
Roider_Union_0.8.1
SCY_1.58RC4
Ship_and_Weapon_Pack_1.10.5
SkilledUp1.1
SpeedUp 0.6.0
Starship_Legends_1.3.14
Sylphon_0.9.6
Tahlan_0.3.14d
Tiandong_Heavy_Industries_1.2.1a
ToggleWeaponGroup 1.1.0
Torchships_0.10a
Trailer_Moments_1.0
Underworld_1.4.2
UnknownSkies_v0.42
Upgraded Rotary Weapons URW_v1.41
Version_Checker_2.0

I have not added any new mods recently

I hope someone can help

--Mana
Logged

Nick XR

  • Admiral
  • *****
  • Posts: 713
    • View Profile
Re: ConcurrentModificationException wile traveling in Hyperspace
« Reply #1 on: March 07, 2020, 04:14:04 PM »

You might try loading again and hanging out in system for a while, perhaps there's something weird in hyperspace that will go away on its own if you're not there.

The CME issue here is caused by one thread modifying a list while another is traversing it.  The below thread is the one doing the traversal, but not the one that did the modification (could be wrong on this).

To diagnose what threads are active (and doing what), please do the following:

0. Open a command prompt and navigate to your starsector install location, then the subdirectory `starsector-core`
1. To give us a bit more info now, run StarSector from the .bat file: starsector.bat
2. This the black console window should have a bunch of text streaming by
3. Load the save that crashes and go into hyper space
4. Alt tab to the console window
5. Hit the key combo CTRL+BREAK every 5 seconds or so until the exception happens and SS crashes
6. Hopefully the crash doesn't close your window
7. Copy the output from the console (the last few hundred lines) and paste it in this thread

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24128
    • View Profile
Re: ConcurrentModificationException wile traveling in Hyperspace
« Reply #2 on: March 07, 2020, 09:50:19 PM »

Hmm - I think the most likely cause here is actually a FleetEventListener (or is it called FleetDespawnListener in the current release?) trying to add/remove a despawn listener to/from the fleet from its reportFleetDespawnedToListener() method.

(I mean, this *could* also be something thread-related, but I'd be surprised if any of the mods listed did that, since it's generally a bad idea and would be fundamentally unsafe given how the core code is structured...)
Logged

AliahMana

  • Ensign
  • *
  • Posts: 3
    • View Profile
Re: ConcurrentModificationException wile traveling in Hyperspace
« Reply #3 on: March 08, 2020, 12:33:54 AM »

Okay i have tried a few things now, but always get the same result

If im in System the crash will not happen, as i stayed there for more than 4 Months and i could fly about without issue.

If i go to Hyperspace and just sit around the game will crash with the same error, but it will take longer.
If i just normally fly in Hyperspace the crash will always happen after about 3 ingame days, and it doesnt seem to matter which ones (i tried February, July and May one year later)

I tried to do what Nick XR talked about, but the CMD just shows exactly what is also written into the Log file. And whenever i click the CMD window while the game is running, the game just stops until refocussed or stops working at all (app hangs until closed via task manager)

An odd thing i noticed is that the crash always seems to happen, when the game tries to switch music. Atleast thats what always shows up in the log before the error.

Code
130564 [Thread-4] INFO  com.fs.starfarer.api.impl.campaign.intel.AnalyzeEntityMissionIntel  - Created AnalyzeEntityMissionIntel: Domain-era Probe, faction: pirates
132922 [Thread-4] INFO  com.fs.starfarer.api.impl.campaign.intel.AnalyzeEntityMissionIntel  - Created AnalyzeEntityMissionIntel: Derelict Ship, faction: independent
134654 [Thread-4] INFO  com.fs.starfarer.api.impl.campaign.intel.SurveyPlanetMissionIntel  - Created SurveyPlanetMissionIntel: Alpha Saleronos I, faction: pirates
135645 [Thread-4] INFO  sound.oo0O  - Cleaning up music with id [Stellar_Rust.ogg]
135651 [Thread-8] INFO  sound.oo0O  - Cleaning up music with id [Sovereignty.ogg]
135826 [Thread-4] ERROR com.fs.starfarer.combat.CombatMain  - java.util.ConcurrentModificationException
java.util.ConcurrentModificationException
at java.util.ArrayList$Itr.checkForComodification(Unknown Source)
at java.util.ArrayList$Itr.next(Unknown Source)
at com.fs.starfarer.campaign.fleet.CampaignFleet.despawn(Unknown Source)
at com.fs.starfarer.api.impl.campaign.fleets.RouteManager.spawnAndDespawn(RouteManager.java:598)
at com.fs.starfarer.api.impl.campaign.fleets.RouteManager.advance(RouteManager.java:572)
at com.fs.starfarer.api.impl.campaign.CoreScript.advance(CoreScript.java:126)
at com.fs.starfarer.campaign.CampaignEngine.advance(Unknown Source)
at com.fs.starfarer.campaign.CampaignState.advance(Unknown Source)
at com.fs.starfarer.BaseGameState.traverse(Unknown Source)
at com.fs.state.AppDriver.begin(Unknown Source)
at com.fs.starfarer.combat.CombatMain.main(Unknown Source)
at com.fs.starfarer.StarfarerLauncher$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
135871 [Thread-10] INFO  sound.oo0O  - Creating streaming player for music with id [Mobilization.ogg]
135871 [Thread-10] INFO  sound.null  - Playing music with id [Mobilization.ogg]

Code
273869 [Thread-10] INFO  sound.oo0O  - Creating streaming player for music with id [Ambush.ogg]
273869 [Thread-10] INFO  sound.null  - Playing music with id [Ambush.ogg]
274110 [Thread-4] ERROR com.fs.starfarer.combat.CombatMain  - java.util.ConcurrentModificationException
java.util.ConcurrentModificationException
at java.util.ArrayList$Itr.checkForComodification(Unknown Source)
at java.util.ArrayList$Itr.next(Unknown Source)
at com.fs.starfarer.campaign.fleet.CampaignFleet.despawn(Unknown Source)
at com.fs.starfarer.api.impl.campaign.fleets.RouteManager.spawnAndDespawn(RouteManager.java:598)
at com.fs.starfarer.api.impl.campaign.fleets.RouteManager.advance(RouteManager.java:572)
at com.fs.starfarer.api.impl.campaign.CoreScript.advance(CoreScript.java:126)
at com.fs.starfarer.campaign.CampaignEngine.advance(Unknown Source)
at com.fs.starfarer.campaign.CampaignState.advance(Unknown Source)
at com.fs.starfarer.BaseGameState.traverse(Unknown Source)
at com.fs.state.AppDriver.begin(Unknown Source)
at com.fs.starfarer.combat.CombatMain.main(Unknown Source)
at com.fs.starfarer.StarfarerLauncher$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

So i tried to deactivate the Sound (unchecked sound from launcher), but that didnt help anything

Code
101446 [Thread-4] INFO  data.scripts.OfficerManagerEvent  - Added admin at market_huascar, 30 total available
101488 [Thread-4] INFO  com.fs.starfarer.api.impl.campaign.intel.ProcurementMissionIntel  - Created ProcurementMissionIntel: rare_metals to Nova Maxios
103512 [Thread-4] INFO  com.fs.starfarer.api.impl.campaign.intel.AnalyzeEntityMissionIntel  - Created AnalyzeEntityMissionIntel: Derelict Ship, faction: independent
103590 [Thread-4] INFO  data.scripts.OfficerManagerEvent  - Removed freelance admin from market_system_511e:planet_6, 30 total available
104090 [Thread-4] ERROR com.fs.starfarer.combat.CombatMain  - java.util.ConcurrentModificationException
java.util.ConcurrentModificationException
at java.util.ArrayList$Itr.checkForComodification(Unknown Source)
at java.util.ArrayList$Itr.next(Unknown Source)
at com.fs.starfarer.campaign.fleet.CampaignFleet.despawn(Unknown Source)
at com.fs.starfarer.api.impl.campaign.fleets.RouteManager.spawnAndDespawn(RouteManager.java:598)
at com.fs.starfarer.api.impl.campaign.fleets.RouteManager.advance(RouteManager.java:572)
at com.fs.starfarer.api.impl.campaign.CoreScript.advance(CoreScript.java:126)
at com.fs.starfarer.campaign.CampaignEngine.advance(Unknown Source)
at com.fs.starfarer.campaign.CampaignState.advance(Unknown Source)
at com.fs.starfarer.BaseGameState.traverse(Unknown Source)
at com.fs.state.AppDriver.begin(Unknown Source)
at com.fs.starfarer.combat.CombatMain.main(Unknown Source)
at com.fs.starfarer.StarfarerLauncher$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

So im out of ideas.

i can provide the Save and the last Log if someone wants to look at it.

https://www.dropbox.com/s/y5uad1lvk6dltjr/save_LazarBriggs_9121847670516156133.rar?dl=0
https://www.dropbox.com/s/2bpzw6l239o7l84/starsector.log?dl=0


I did not modify any mods or files for this save, so all Mods are as is.


thanks for your time

--Mana
« Last Edit: March 08, 2020, 12:55:47 AM by AliahMana »
Logged

Nick XR

  • Admiral
  • *****
  • Posts: 713
    • View Profile
Re: ConcurrentModificationException wile traveling in Hyperspace
« Reply #4 on: March 08, 2020, 11:50:03 AM »

Yeah, Alex is right, probably not a threading issue.

My guess is one of the listeners that has 'reportFleetDespawnedToListener' called on it, calls the method
Code
List<FleetEventListener> getEventListeners()
and modifies the ArrayList causing this to happen on the next iteration.

I don't know how to diagnose this further without pulling the source for all the mods, putting it in a debugger and seeing who is being naughty.

If you're feeling ambitious you could track down the sources for the mods and search for the string `getEventListeners()` and see which mods are even calling that method, that would narrow this down quite a bit.

Failing that, my guess would be it's a newer mod, otherwise we probably would have seen this before on the forums.

AliahMana

  • Ensign
  • *
  • Posts: 3
    • View Profile
Re: ConcurrentModificationException wile traveling in Hyperspace
« Reply #5 on: March 08, 2020, 12:09:23 PM »

Hm... well i dont really have much of an idea about code or programming, so i dont think i can dig anything up.

All mods have been in this game for a while. The last mod i updated was Tahlan Shipworks from Tahlan_0.3.14c to Tahlan_0.3.14d. But i have played for hours after that so i am not shure. The last mod i added was Industrial Evolution, but thats been a week ago or so. And i have played for many hours since then.

Maybe someone else will have this problem too and can figure it out.

--Mana
Logged