Closed nairol closed 12 years ago
ConcurrentModificationException documentation:
This exception may be thrown by methods that have detected concurrent modification of an object when such modification is not permissible.
For example, it is not generally permissible for one thread to modify a Collection while another thread is iterating over it. In general, the results of the iteration are undefined under these circumstances. [...] Note that this exception does not always indicate that an object has been concurrently modified by a different thread. If a single thread issues a sequence of method invocations that violates the contract of an object, the object may throw this exception. For example, if a thread modifies a collection directly while it is iterating over the collection with a fail-fast iterator, the iterator will throw this exception. [...]
xe.h [Line 1143] translates to World.updateEntities() [Line 1905]
this.theProfiler.endStartSection("tileEntities");
this.scanningTileEntities = true;
var5 = this.loadedTileEntityList.iterator();
while (var5.hasNext())
{
TileEntity var6 = (TileEntity)var5.next();
Last line causes the Exception by trying to iterate over World.loadedTileEntityList while it is modified elsewhere. (?)
Other places in vanilla Minecraft that access World.loadedTileEntityList:
My MCP and Eclipse setup is not up to date so I'll just leave this here as a starting point.
addTileEntity(TileEntity) is called by WDL in importTileEntities(Chunk). importTileEntities(Chunk) is called while saving a chunk. This is asynchronous to the thread where updateEntities() is executed. This could be the problem.
Of the places that access World.loadedTileEntityList that I listed in the above comment, only one forgets to check the kind-of-mutex World.scanningTileEntities and unfortunately WDL uses exactly that method. My fault. :(
I think we just have to port the method WDL.importTileEntities(Chunk) to using World.addTileEntity(Collection) or World.setBlockTileEntity(...).
I'll test this tomorrow...
Thanks for diagnosing that one. Good catch. If you have time to test it out, that's great. If not, I can get get to it on Friday PDT.
Actually I can't really test if it doesn't crash anymore because I haven't gotten it to crash with WDL 1.4.2 beta 6 and Optifine at all. Maybe I have to try the other mods as well.
This needs to be tested by the original bug reporter from the forum. I couldn't reproduce the bug even with all the listed mods installed.
I posted v2 BETA 7 on the forum thread and a message quoting the original reporter. I'll close this issue now and reopen if it's reported again.
Original report: http://www.minecraftforum.net/topic/1444862-142-world-downloader-mod/page__st__140#entry18833574
MC crashes half the time when I click Stop Download.
Installed mods:
I think it is related to Optifine but haven't found out what the problem is.