I have the following deadlock that sometimes happen:

Thread 1:
start the bundle
register a ManagedServiceFactory

Thread 2:
stop the bundle
grab the bundle lock
try to destroy the ManagedServiceFactory
deadlock on grabbing the ManagedServiceFactory lock

Thread 3:
in a different thread, the ConfigAdmin will call the
ManagedServiceFactory#update()
enter synchronized block in the ManagedServiceFactory
register a service
try to grab the bundle lock


I don't think the problem comes from my ManagedServiceFactory, as it
has to be synchronized in order for the destruction of the
ManagedServiceFactory to make sure we destroy all the previously
created services.

It seems to me that the problem comes from FELIX-3082 which allows the
registration of services while the bundle is stopping.
I think if we remove that bit, the third thread will reject the
service registration, exit the ManagedServiceFactory#update() and
release the ManagedServiceFactory lock.

I'll give it a try, but thoughts are welcomed.

-- 
------------------------
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
FuseSource, Integration everywhere
http://fusesource.com

Reply via email to