You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
openHAB provides addons with API for obtaining shared thread pools (ThreadPoolManager), which is also used to obtain scheduler property in BaseThingHandler. It's a good thing so that everyone isn't spawning their own threads and most addons use it.
The problem is that nothing stops any addon from shutting down this shared pool, which has catastrophic consequences. When that happens, all addons/services which use that shared pool stop working, throwing java.util.concurrent.RejectedExecutionException when they try to schedule new jobs. There's no way to recover from that other than restarting openHAB, and it's also hard to diagnose since lots of things keeps working fine.
I've recently encountered this problem with miio binding, but forum seems to be full of similar problems (like this or this, and I'm certaint that I encountered this problem a few times myself before) and it's pretty much impossible from logs to find out what happened, because the exception is thrown from first addon that tries to use that shared pool after it was shut down.
I'd propose overriding shutdown() and shutdownNow() methods on WrappedScheduledExecutorService (and maybe also on QueueingThreadPoolExecutor) to either do nothing, or at least log some warning with stack trace when someone calls them. It shouldn't cause any issues since ThreadPoolManager isn't shutting them down and noone else should either since they are supposed to be shared.
The text was updated successfully, but these errors were encountered:
openHAB provides addons with API for obtaining shared thread pools (ThreadPoolManager), which is also used to obtain
scheduler
property in BaseThingHandler. It's a good thing so that everyone isn't spawning their own threads and most addons use it.The problem is that nothing stops any addon from shutting down this shared pool, which has catastrophic consequences. When that happens, all addons/services which use that shared pool stop working, throwing
java.util.concurrent.RejectedExecutionException
when they try to schedule new jobs. There's no way to recover from that other than restarting openHAB, and it's also hard to diagnose since lots of things keeps working fine.I've recently encountered this problem with miio binding, but forum seems to be full of similar problems (like this or this, and I'm certaint that I encountered this problem a few times myself before) and it's pretty much impossible from logs to find out what happened, because the exception is thrown from first addon that tries to use that shared pool after it was shut down.
I'd propose overriding
shutdown()
andshutdownNow()
methods on WrappedScheduledExecutorService (and maybe also on QueueingThreadPoolExecutor) to either do nothing, or at least log some warning with stack trace when someone calls them. It shouldn't cause any issues sinceThreadPoolManager
isn't shutting them down and noone else should either since they are supposed to be shared.The text was updated successfully, but these errors were encountered: