OpenLiberty / open-liberty-tools

Open Liberty Tools are lightweight tools for developing, assembling, and deploying apps to Open Liberty.
http://openliberty.io
Eclipse Public License 1.0
51 stars 41 forks source link

Defer activator code that requires UI thread #500

Closed pnickoll closed 6 months ago

pnickoll commented 6 months ago

Due to a change in Eclipse that required some code to run on the UI thread we had updated our code to run a syncExec to achieve this.

The deadlock problem appears to be caused by the following:

The bundle is starting up and during startup it tries to register an icon which requires an image registry which in turn needed to be run on a UI thread so this thread is sitting waiting for a slot on the UI thread.

The UI thread is waiting for all the bundles to start up and is hitting timeouts loading classes which eventually does continue and unblocks but does cause a hang while this happens.

The fix is defer the registering of an icon so that instead of happening during the activator starting up it happens whenever a thread tries to access the singleton bundle instance for the first time (which is typically when Eclipse asks us for an icon). This means that the bundle can complete it's startup without requiring access to the UI thread. This in turn means the UI thread that is waiting for the bundles to startup can continue and not hit timeouts on classloading.