IcedTea-Web icon indicating copy to clipboard operation
IcedTea-Web copied to clipboard

rewrite OutputController to use reentrant locks

Open dimitryc opened this issue 2 years ago • 0 comments

Attaching thread dump after deadlock reproducible with MS PowerAutomate tool installed itw-dump.txt

The main thread:

  • PowerAutomate tool registers itself as an Assistive technology, so AWTToolkit.getToolkit() will trigger the loading of the PowerAutomate's code under the AWT lock
  • The PowerAutomate's code prints to the console. Since ITW overrides write to the console, this results in calls to OutputController.log() and an attempt to acquire the OutputController lock

The output deamon:

  • The thread calls to OutputController.consume() in a loop with the OutputController lock acquired. It calls to EQ.invokeLater and attempts to get the AWT lock

It looks like it makes sense to rewrite the OutputController to use reentrant locks to guard access to the messageQue so that the consume() is a mqLock-free method. Please review the patch. Thanks

dimitryc avatar Jul 24 '23 15:07 dimitryc