<Swing Dev> [9] Review Request for 8030702: Deadlock between subclass of AbstractDocument and UndoManager

Alexander Scherbatiy alexandr.scherbatiy at oracle.com
Thu Jul 30 12:26:11 UTC 2015


On 7/28/2015 8:24 PM, Semyon Sadetsky wrote:
> Hello,
>
> Please review fix for JDK9:
> bug: https://bugs.openjdk.java.net/browse/JDK-8030702
> webrev: http://cr.openjdk.java.net/~ssadetsky/8030702/webrev.00/
>
> The deadlock happens if undo/redo is called on the document while its 
> content is being updated from another thread.
> The proposed solution is to reorder mutex acquisitions in the undo 
> manager assigned to an AbstractDocument. Document's lock is obtained 
> in its undo manager with a minimal change of the current API. A stress 
> test scenario is added to reproduce the issue.

    UndoManager is a general class that can be used not only by 
AbstractDocument. It does not seem as good idea to store references from 
other classes that have deadlocks with UndoManager in the UndoManager.
    It looks like AbstractDocument violates UndoManager synchronization 
contract when it both use lock to work with UndoManager and in the 
implemented undo() method.

   Thanks,
   Alexandr.

>
> --Semyon
>




More information about the swing-dev mailing list