Projects tigase _server server-core Issues #1224
ClassCastException: class java.lang.Boolean cannot be cast to class tigase.util.common.TimerTask (#1224)
wojciech.kapcia@tigase.net opened 4 years ago
[2020-12-03 11:04:12:359] [SEVERE  ] [        Watchdog - c2s ] ThreadExceptionHandler.uncaughtException(): Uncaught thread: "Watchdog - c2s" exception
java.lang.ClassCastException: class java.lang.Boolean cannot be cast to class tigase.util.common.TimerTask (java.lang.Boolean is in module java.base of loader 'bootstrap'; tigase.util.common.TimerTask is in unnamed module of loader 'app')
	at tigase.server.xmppclient.StreamManagementIOProcessor.serviceStopped(StreamManagementIOProcessor.java:394)
	at tigase.xmpp.XMPPIOService.forceStop(XMPPIOService.java:217)
	at tigase.net.IOService.stop(IOService.java:445)
	at tigase.xmpp.XMPPIOService.stop(XMPPIOService.java:264)
	at tigase.server.xmppclient.ClientConnectionManager.xmppStreamClosed(ClientConnectionManager.java:380)
	at tigase.server.xmppclient.ClientConnectionManager.serviceStopped(ClientConnectionManager.java:302)
	at tigase.server.xmppclient.StreamManagementIOProcessor.serviceStopped(StreamManagementIOProcessor.java:392)
	at tigase.xmpp.XMPPIOService.forceStop(XMPPIOService.java:217)
	at tigase.net.IOService.writeData(IOService.java:1007)
	at tigase.xmpp.XMPPIOService.writeRawData(XMPPIOService.java:279)
	at tigase.server.ConnectionManager$Watchdog$1.check(ConnectionManager.java:1461)
	at tigase.server.ConnectionManager.doForAllServices(ConnectionManager.java:854)
	at tigase.server.ConnectionManager$Watchdog.executeWatchdog(ConnectionManager.java:1409)
	at tigase.server.ConnectionManager$Watchdog.run(ConnectionManager.java:1377)
wojciech.kapcia@tigase.net commented 4 years ago

The issue stems from the fact that in tigase.server.xmppclient.StreamManagementIOProcessor#resumeStream a boolean is assigned to a key that usually holds (and is expected) TimerTask (https://github.com/tigase/tigase-server/blob/c2a7fc71334e2eb66d78c1ff9e55310db21d0d45/src/main/java/tigase/server/xmppclient/StreamManagementIOProcessor.java#L516-L516). I tried analysing the code but I couldn't figure out the intention behind oldService.getSessionData().put(RESUMPTION_TASK_KEY, true);. @andrzej.wojcik , as you are the author of this line could you take a look?

Andrzej Wójcik (Tigase) commented 4 years ago

I'm not sure why Boolean was used instead of TimerTask (most likely to release resources as older version used TimerTask from JDK and now our custom TimerTask based on Scheduler/Executor are used.

I've adjusted the code to "behave" in a way I suppose it was designed to behave. Weird thing is that this code is very old and there was never an issue like this one. Most likely resumption timeout was long and Watchdog was short and they started to interfere.

Looking at recent changes in the source code of Tigase XMPP Server, most of the issues which are now solved are related to concurrency and would appear on "slow" systems or on systems which are near to be overloaded as processing times are longer than expected and things which should not interfere are starting to interfere.

issue 1 of 1
Type
Bug
Priority
Normal
Assignee
Version
tigase-server-8.2.0
Spent time
15m
Issue Votes (0)
Watchers (0)
Reference
tigase/_server/server-core#1224
Please wait...
Page is in error, reload to recover