Concurrent Modifier Exception. I can't track it down [Solved]

SpongeForge Beta 3.1.0 1084
Forge Build: 1.8.9 … 1715
Java 1.8

spoiler “Forge Logs”

I’m getting both a ConcurrentModifierException and a NullpointerException which forces the world to save and quit upon a player logging in. I’ve done a ton of debugging, but I can’t seem to find out whats going on other than a null pointer in ChunkBuilder line 78.

Thing is, the classes that provide the data for ChunkBuilder to do its stuff on (VolcanicSystem and VeinSystem) should never provide it with a null pointer.


  1. made sure all added points were converted to chunk coordinates
  2. Changed all HashMaps to Hashtables.

No null pointers or concurrent modifier exceptions atm. This has illuminated other worrying behavior though.

Care to try SpongeForge build 1086?

theres a new one? ok i’ll try it out.

Actually, I take it back, that CME is from your end. I’m not 100% sure but you’re already iterating over BlockInfo’s keys.

Yeah. I think its coming from my end, but I just don’t know where it would be from. A String Set is immutable right?

Not by default, from what I can tell, you’re making several unions of the key sets, which isn’t isolating that set any from the other internal sets (basically, you want to make a new set to return and just addAll or whatever functionality you need to do on that new set, not on the key sets you’re using). BlockInformation itself isn’t very “safe” in that regard since it leaks all sorts of references to it’s own internal map.

So in effect after the union is done, I need to ‘copy’ the members of the set into a new set and return that?

Did the .addAll function with a new HashSet. Still no sign of skywalker :frowning:

 public static Set<String> checkUnion()
		Set<String> oreSet = ore.keySet();
		Set<String> rockSet = rocks.keySet();
		Set<String> keyOreSet=null, keyRockSet=null;
		Set<String> returningSet = new HashSet<String>();
			keyOreSet =	Sets.intersection(oreSet,chunkGen); 
			keyRockSet = Sets.intersection(rockSet,chunkGen);
		if(keyRockSet!=null && keyOreSet!=null) {
			returningSet.addAll(Sets.union(keyRockSet, keyOreSet));
		else if(keyRockSet!=null) {
		else if(keyOreSet!=null) {
		return returningSet;

You’ve got a null check missing in your ChunkBuilder.

Thats weird. there’s no setter for field: block, and the constructor requires a string param.
I think? I fixed it. It seems like the null pointer was related to something else. ConcurrentModifier error was fixed by changing my HashMaps to Hashtables. I’m gonna go ahead and call this one ‘solved’, but there is still some runtime behavior that is worrying. I’ll put it in another thread.