GalaxeTV/GalaxeSMP

Twitch4J doesn't cleanly shutdown during a server shutdown/restart

Closed this issue · 2 comments

On shutdown, the Twitch4J library doesn't shutdown properly.

[03:45:24] [Server thread/INFO]: [GalaxeSMP] Disabling GalaxeSMP v1.0-SNAPSHOT
[03:45:24] [Server thread/INFO]: [com.github.twitch4j.TwitchClient] Closing TwitchClient ...
... other logs ...
[03:45:24] [twitch4j-TtcL-3/ERROR]: [com.github.twitch4j.chat.TwitchChat] Chat: Unexpected error in worker thread
java.lang.InterruptedException: null
	at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:1679) ~[?:?]
	at java.util.concurrent.ArrayBlockingQueue.poll(ArrayBlockingQueue.java:435) ~[?:?]
	at com.github.twitch4j.chat.TwitchChat.lambda$new$0(TwitchChat.java:349) ~[galaxesmp-1.0-SNAPSHOT-all.jar:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[?:?]
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) ~[?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
	at java.lang.Thread.run(Thread.java:833) ~[?:?]
... other logs ...
[03:45:24] [ReadingThread/WARN]: Exception in thread "ReadingThread" java.lang.IllegalStateException: zip file closed
[03:45:24] [ReadingThread/WARN]: 	at java.base/java.util.zip.ZipFile.ensureOpen(ZipFile.java:831)
[03:45:24] [ReadingThread/WARN]: 	at java.base/java.util.zip.ZipFile.getEntry(ZipFile.java:330)
[03:45:24] [ReadingThread/WARN]: 	at java.base/java.util.jar.JarFile.getEntry(JarFile.java:518)
[03:45:24] [ReadingThread/WARN]: 	at java.base/java.util.jar.JarFile.getJarEntry(JarFile.java:473)
[03:45:24] [ReadingThread/WARN]: 	at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:163)
[03:45:24] [ReadingThread/WARN]: 	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:587)
[03:45:24] [ReadingThread/WARN]: 	at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:108)
[03:45:24] [ReadingThread/WARN]: 	at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:103)
[03:45:24] [ReadingThread/WARN]: 	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
[03:45:24] [ReadingThread/WARN]: 	at galaxesmp-1.0-SNAPSHOT-all.jar//com.neovisionaries.ws.client.ReadingThread.runMain(ReadingThread.java:69)
[03:45:24] [ReadingThread/WARN]: 	at galaxesmp-1.0-SNAPSHOT-all.jar//com.neovisionaries.ws.client.WebSocketThread.run(WebSocketThread.java:45)

Pull Request #4 may resolve this issue.

This is confirmed fixed. Seems like forcing the connections to close rather than asking nicely seems to work.

Closed.