Realistic Terrain Generation

Realistic Terrain Generation

3M Downloads

ConcurrentModificationExceptions more common with 0.6.0

Haggle1996 opened this issue ยท 14 comments

commented

https://gist.github.com/Haggle1996/6b38a8d218c6283debb9

Since 0.6.0 (tested with 0.6.1), I'm getting a lot more ConcurrentModificationExceptions. Normally, I just ignore them, because previously they only seem to happen in maybe 1/20 worlds...and then restarting works and they rarely happen a second time. Now, I'm getting them on virtually every seed.

@Greymerk, not sure if this is you or RTG, but pinging you here.

commented

I immediately have to suspect the village block modifications, although I don't think this problem came up with UB and it's doing a similar trick.

commented

I updated to Revolution 2 v2.1.3.0-BETA-HOTFIX2, plugged in RTG 0.6.2, and I flew around in a world for a while and didn't crash. Obviously I could have just gotten unlucky (not getting a crash) since I only tried one test world. I would have continued making more test worlds and trying to reproduce this, but this modpack is seriously hefty for SSP on the integrated server. After a while I had to quit because the JVM garbage collector was getting too bogged down and I was anticipating the JVM taking a huge dump. (Not all of us have awesome computers. :P)

Anyways, if you could try to narrow down which mods are involved in causing this it would help out greatly.

Later, when I have more time, I'll try messing with just Roguelike Dungeons, RTG (0.6.0 and 0.6.2), CC, and some support mods using the config settings from the modpack, as it looks like the crash is happening during some sort of structure generation from Roguelike.

Also note: In my test world I was getting a great deal of structures generating in the ocean biomes where they probably shouldn't be.

commented

Also, adding the full fml-client-latest.log

https://gist.github.com/Haggle1996/2fdcae7b232a5fdac204

Roguelike hasn't updated for a while, so it's something that's updated in the last little bit. Unfortunately, with CMEs, you only know the side that crashed, not the side that caused the crash. :D I'll see if I can get a world seed that consistently CMEs, that would probably help you, if we can reproduce it. :)

commented

I created several more maps last night and this morning -- the issue occurs when @Greymerk's roguelike dungeon and a village generate nearby each other. They're obviously fighting for who gets to win the block placement war. While it's clear RLD is on the one side of the CME equation, it's not clear what's on the other. I have a hunch it's related to @Funwayguy / @GenDeathrow EnviroMine's mineshaft, as it's the only structure that generates that deep (if you look at the errored block in the crash log, it's at y-49. The village itself is in the mid 70s. So the issue probably doesn't belong on the RTG tracker. :)

commented

Just as a side note, I believe the reason this appeared much more often in 0.6.0 is that I altered both the list of biomes villages are allowed to generate in, as well as the frequency of those biomes.

commented

Greymerk/minecraft-roguelike@fe57dd2

I have a suspicion that this commit to Roguelike is somehow involved. Instead of throwing an exception when something has gone wrong, it ignores it and continues until something else breaks down the line.

Greymerk's reason for the commit is "ignore null pointer exceptions from setting blocks in world", so there is obviously some history of problem here.

In any case, I doubt this is RTG's fault.

commented

I'm not so sure... from my quick crash course on ConcurrentModification exceptions (no laughing), it would seem that 2 different threads are trying to modify the same object, which in this case is a LinkedList inside RTG's MapGenVillageRTG class... but since RLD doesn't get involved with village gen, I don't see how it could be RLD's fault. But then again, I don't see how it could be RTG's fault either since MapGenVillageRTG is almost a carbon-copy of the vanilla village generator.

Dammit, isn't there anyone else we can blame?! looks at Haggle ;)

commented
commented

Independently, I disabled mine shafts in my pack and I haven't been able to reproduce the problem. Thanks for following up -- I probably owe you a beer or rootbeer, whichever is most age- and/or preference-appropriate

commented

I've never seen this issue come up with my mod just in vanilla. This crash never ever happens. People were bugging me about this crash when combined with other mods and I finally decided to put a catch for stray NPEs.

I don't really see how I can take responsibility for a crash that happens after I call world.setBlock it's out of my hands after that point. Correct me if i'm wrong.

commented

@Greymerk my apologies if any of the language here sounds accusatory -- it's not meant to be.

You're not likely to see this problem when running any mod by itself, as CMEs occur when two mods try to modify the same data structure simultaneously. This is particularly hard to debug because the mod that throws the error is usually not the one causing the blocking. You probably already know all this...

In this case, it's Enviromine that's blocking the data structure when it's generating a mineshaft, but the error itself looks like it comes from Roguelike, or one of the other mods mentioned in the chain (Streams/farseek/RTG/ChromatiCraft/FastCraft). There's also no good way to force mods to execute in a particular order, outside of hacky jar-renaming, so it can work in one environment, then fail in the next.

Anyway, I wouldn't expect you to own this. I'm grateful the RTG folks have added a catch for this in their latest update today -- keeps the game from crashing on hapless players and reduces the number of bug reports. Both RTG and the skinned Roguelike Dungeons I did with your bunker towers are some of the most complimented pieces of my pack. Thank you all for your hard work!

commented

One thing that often helps with CMEs is to never alter lists while you're working on them. Just out of habit, I save lists of items to add or remove and then go through afterwards and change them. I think remove() is smart enough that it won't crash the loop it's used in but not necessarily somebody else's list.

commented

Just to add to the explanation of this, usually this crash occurs when two modded structures overlap mid construction causing the structure cache to be modified while it's still iterating over it. This is something that tends to be very difficult to detect and fix from experience however I have since added a few countermeasures in EnviroMine in an attempt to prevent these kind of errors from happening. The shafts also generate piece by piece as the chunks generate naturally, not as a whole, so any pieces generated outside the village entry shaft would not trigger this kind of crash.

EDIT: If a Rogue-like Dungeon generated underneath a village and isn't part of the village structure itself there is a potential for this kind of crash to happen.

commented

Thanks, that's cool. I really do not know much about these CMEs. I just do what I do, and I only ever hear people complain about this once in a great while. I keep hoping that whatever it is was fixed in the latest version of forge.