-
Notifications
You must be signed in to change notification settings - Fork 780
Karaf not stopping threads upon removing a bundle #5551
Comments
No, bindings must do that! When bundles are stopped, their It's clearly a bug in the binding if any threads and/or scheduled jobs are not cancelled properly after |
@SJKA Well, I am not sure what is happening then, because I do get rid of the threads in the dispose(), but somehow they keep running afterwards. Note, this is while deleting the .jar from the add-ons folder. I am not sure how that impacts the stopping of the bundle |
I am pretty sure that Karaf does a proper "bundle uninstall" when you remove the jar - I'd suggest to go through with the debugger to see whether dispose is called and why your threads keep running. |
Hi, what about it issue? |
Would that be some hint: #6636 |
This code base is unmaintained and has been migrated. See: #6883 |
When stopping or removing a bundle (e.g. from the add-ons folder) from Karaf, threads that are created by that bundle keep running and are not terminated. Sometimes end-users do upgrade bundles in running instances, and in doing so, duplicating threads could be the result, with various side effects and so forth. AFAIK none of the binding bundles implement a mechanism to stop lingering threads. One can take action in ThingHandler::dispose() to clean up resources, but when bundles are removed, then this is no helpful (I think).
A mechanism sh(c)ould be put in place to catches such threads or allow developers to clean up after such a removal.
One option would be to do something with ThingHandlerFactory::deactivate(); Another option could be to have ThingHandlers register the threads they create in a registry that is centrally controlled, or that is managed by the bundle's ThingHandlerFactory. Or have the all the threads run in a thread pool that is that is monitored by the core (which is just a question of defining coding guidelines I guess)
The text was updated successfully, but these errors were encountered: