the8472 / mldht

Bittorrent Mainline DHT implementation in java
Mozilla Public License 2.0
147 stars 45 forks source link

Possible ConcurrentModificationException on gracefully stopping #3

Closed alevohin closed 8 years ago

alevohin commented 8 years ago

Possible ConcurrentModificationException on gracefully stopping, please see log:

mldht@mldht:~/mldht$ ps ax | grep java
26529 pts/5    Sl     9:22 java -XX:+UnlockExperimentalVMOptions -XX:+UnlockDiagnosticVMOptions -Xms300m -Xmx1500M -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:MaxGCPauseMillis=15 -XX:GCTimeRatio=19 -XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly -Xdebug -Xrunjdwp:transport=dt_socket,address=127.0.0.1:10044,server=y,suspend=n -Xloggc:logs/gc.log -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+PrintGCDetails -XX:+HeapDumpBeforeFullGC -XX:+HeapDumpOnOutOfMemoryError -XX:OnOutOfMemoryError=kill -9 %p -XX:+AggressiveOpts -XX:MaxInlineLevel=12 -XX:+TrustFinalNonStaticFields -XX:+AggressiveUnboxing -XX:+PreserveFramePointer -cp /home/mldht/mldht/bin/../target/* the8472.mldht.Launcher
28069 pts/5    S+     0:00 grep --color=auto java
mldht@mldht:~/mldht$ kill -15 26529
mldht@mldht:~/mldht$ Exception in thread "shutdownHook" java.util.ConcurrentModificationException
        at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:901)
        at java.util.ArrayList$Itr.next(ArrayList.java:851)
        at lbms.plugins.mldht.kad.DHT.stop(DHT.java:826)
        at java.util.ArrayList.forEach(ArrayList.java:1249)
        at the8472.mldht.Launcher.shutdownCleanup(Launcher.java:272)
        at the8472.mldht.Launcher.onVmShutdown(Launcher.java:97)
        at java.lang.Thread.run(Thread.java:745)
the8472 commented 8 years ago

can't reproduce, but that isn't very surprising giving a race codintion. see if the latest commit fixes it.

I usually shutdown with touch shutdown, but of course TERM should be handled gracefully too.