XmlBeans can Deadlock Threads
-----------------------------

                 Key: XMLBEANS-388
                 URL: https://issues.apache.org/jira/browse/XMLBEANS-388
             Project: XMLBeans
          Issue Type: Bug
          Components: XmlObject
    Affects Versions:  Version 2.3,  Version 2.3.1, Version 2.4 
         Environment: Windows XP, Java 1.6
            Reporter: Paul Hepworth


The situation can occur when calling a setter on an XmlObject which 
synchronizes on Locale A, to set an XmlObject which synchronizes on Locale B at 
the same time as calling a setter on an XmlObject which synchronizes on Locale 
B to set an XmlObject which synchronizes on Locale A.

The code within XmlObjectBase is fine, but the problem lies in the generated 
code compiled from a schema. 

The code that is generated contains a synchronized block on the monitor (Locale 
A or B depending on the object), and then delegates to the XmlObjectBase set 
method, which detects that you need to lock more than 1 Locale and so acquires 
a GlobalLock and then synchronizes on both monitors. 

As another thread can be doing the reverse, you can end up with 2 threads, one 
with Locale A locked, and one with Locale B locked. The first one then acquires 
a GlobalLock, but can never obtain a lock on the other Locale.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to