[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xmlbeans-dev
Subject:    RE: RE: XmlBeans and Synchronization
From:       "Cezar Andrei" <cezar.andrei () oracle ! com>
Date:       2008-11-06 16:53:37
Message-ID: 20081106105337650.00000001112 () CEZAR01
[Download RAW message or body]

You're right Paul, using setXXX methods like you describer can get to a deadlock. \
We're working on a fix for this.

 

Cezar

 

________________________________

From: Paul Hepworth [mailto:Paul.hepworth@detica.com] 
Sent: Thursday, October 30, 2008 3:42 AM
To: dev@xmlbeans.apache.org; cezar.andrei@oracle.com
Subject: RE: RE: XmlBeans and Synchronization

 

Hi Cezar

 

The deadlock isn't happening because of code in XmlObjectBase, but rather because of \
generated code from the schema.

 

So when I compile our schema, if I look at any setXXX(.) method in the generated \
sources, it synchronizes on its monitor first.

 

There is then a call to check_orphaned(), followed by a call to \
get_store().find_element_user(.) (or add_element_user(.) if it's not in the store), \
and finally a call to set(.) which ends up in the XmlObjectBase set method, which \
will then do as you've described. 

 

The issue that is causing the deadlock is that the generated code has already \
synchronized on the monitor (step 1a in my mail).

 

Thanks

Paul

 

________________________________

From: Cezar Andrei [mailto:cezar.andrei@oracle.com] 
Sent: 29 October 2008 21:08
To: dev@xmlbeans.apache.org
Subject: RE: RE: XmlBeans and Synchronization

 

Paul, 

 

Actually the code that does the set() synchronization is the following (see \
XmlObjectBase:2048):

 

                            // about to grab two locks: don't deadlock ourselves

                            GlobalLock.acquire();

                            acquired = true;

 

                            synchronized (monitor())

                            {

                                synchronized (obj.monitor())

                                {

                                    GlobalLock.release();

                                    acquired = false;

 

                                    newObj = setterHelper( obj );

                                }

                            }

 

There are 3 places where a thread can get stuck: 

1)   before GlobalLock.acquire(): Since it's a GlobalLock, only one thread can run \
between GlobalLock.acquire(); and GlobalLock.release(); at one time.

2)   Before synchronized (monitor()): which means that another thread is doing \
something on this object, but since the other thread doesn't have the global lock, it \
means that the other thread should have everything needed to finish its operation.

3)   Before synchronized (obj.monitor()): same as before but on the second object.

 

Assuming that the application that is using XMLBeans doesn't use GlobalLock, or uses \
some other external synchronization, I don't see how a deadlock could happen in your \
scenario.

 

Cezar

 

________________________________

From: Paul Hepworth [mailto:Paul.hepworth@detica.com] 
Sent: Wednesday, October 29, 2008 11:37 AM
To: dev@xmlbeans.apache.org
Subject: RE: RE: XmlBeans and Synchronization

 

All

 

I believe I have found a defect with XmlBeans which can cause a deadlock to occur \
under a specific situation.

 

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

 

The code which XmlBeans generates follows this flow:

1.    MyObjectUnderLocaleA.setMyElement(MyObjectUnderLocaleB)

a)    Synchronize on monitor()

b)    Delegates to XmlObjectBase.set(XmlObject src)

                                                                 i.      Identifies \
that MyObjectUnderLocaleA.monitor() != MyObjectUnderLocaleB.monitor()

                                                             ii.      \
GlobalLock.acquire

                                                         iii.      Synchronize on \
monitor()

                                                             iv.      Synchronize on \
MyObjectUnderLocaleB.monitor()

 

So if the reverse is happening concurrently, Thread 1 will have a lock on Locale A \
and the GlobalLock, and Thread 2 will have a lock on Locale B and wait to get the \
GlobalLock - hence the deadlock situation.

 

It may be that this is arising from a strange/undesired use of XmlBeans - we have a \
HashMap which caches template XmlBean objects, and when we need an instance of the \
template, we were calling the copy() method and returning that. I believe this means \
the template and our instance share the same locale. Once the number of users ramps \
up, there are a lot of users sharing the same locale and consequently introducing a \
lot of contention.

 

We have worked around the problem for now by performing an \
XmlObject.Factory.parse(...) and so each returned object is then in its own Locale.

 

If someone can confirm this, can it be raised as a defect? If it's not a defect, then \
is there a way to do a deep copy that will create the new object in a new Locale?

 

Thanks

Paul

 

-----Original Message-----
From: Paul Hepworth 
Sent: 27 October 2008 14:28
To: 'dev@xmlbeans.apache.org'
Subject: RE: XmlBeans and Synchronization

 

Hi Radu

 

Thanks for the explanation. In theory it all seems sound. Only our application is \
getting itself locked somehow.

 

I've done a thread-dump from Weblogic, and have multiple threads waiting on \
XmlObjectBase.java:1944 which is fine and to be expected as per your explanation.

 

I then have another thread which is stuck on XmlObjectBase.java:1949 - so this is the \
one that has the GlobalLock, but is in turn waiting on another lock which isn't \
getting released at all.

 

I have several other threads that are blocked on XmlObjectBase.java:116 performing a \
copy which I believe are fine and just waiting for a lock.

 

I then have a few threads performing simple gets that are blocked waiting for locks \
on Locale.

 

I have no other threads that are doing any processing (I've left the app in this \
state for 10 or so minutes and all the threads are just locked up)

 

As I can't find much info on the net, could you explain a bit more about the Local \
please? 

What I'd like to know is the following:

      - Is there a new Local per instance of a document or a shared one for all \
instances of the same type? i.e. if I call MyDocument.Factory.newInstance(), does \
this get a new Local each time, or 1 shared one for all MyDocument instances?

      - We have a template service that reads and parses XML stored in the DB, this \
is cached for performance reasons, and when we request a template, we call the copy() \
method. Does this mean that each copied instance shares the same Locale? If that's \
the case, this will greatly impact the performance of our app.

      - Basically... what determines the Locale?

 

Additionally, you mention turning off synchronisation... I've attempted this in the \
code using XmlBeans 2.3.0 and run into the problems mentioned here: \
https://issues.apache.org/jira/browse/XMLBEANS-328 it should also be noted that we \
were having these errors in our performance test environment originally and applied \
the patch mentioned. This stopped the errors described, however we were still running \
into the deadlock situation.

Is this something which has been fixed in 2.4? Is it a safe option to turn off \
synchronisation?

 

Any help greatly appreciated!

Thanks

Paul

 

 

Hi Paul,

 

I can tell you what the synchronization strategy is. Each XmlObject belongs to an xml \
document,

and each xml document belongs to what XmlBeans calls a Locale object (nothing to do \
with the

Java Locale). This is the synchronization domain for XmlBeans. When doing a set, \
there are

two XmlObjects involved: the source (the parameter of the "set" method) and the \
target (the

object you're calling "set" on). XMLBeans requires that they both be synchronized. \
Now, if

the synchronization domain for the two is the same (the same Locale object), then \
there's

no problem (see check at XmlObjectBase.java:1934 if you have the 2.3.0 source). But \
if the

synchronization domain is not the same, then it means that two locks must be acquired \
and

so there is a possibility for deadlock. In order to avoid the deadlock, XMLBeans has \
the "GlobalLock".

This global lock is held only for as long as it is necessary to acquire the two \
XmlObject

locks and then it is immediately released. This guards against the deadlock, but \
doesn't guard

against the possibility that one thread grabs the global lock and then blocks on \
waiting for

another thread to finish with one of the XmlObject locks it is trying to acquire. \
Eventually,

it will grab the lock it is waiting for and then release the Global lock, but while \
it is

waiting, all the other threads in the whole system are prevented from initiating a \
set that

requires two locks, which can be a problem.

 

So I think first of all, it would be interesting for you to look at the stack traces \
for all

the threads to confirm my scenario above. Then, as far as solution, the only reliable \
one

that I know of is not use the "setMyValue" method and replace it with "addNewMyValue" \
whenever

possible because it doesn't require synchronization (and the overall performance is \
better).

In XMLBeans 2.4.0, I think, removing synchronization altogether from the XMLBeans \
layer would

also solve the problem.

 

Radu

 

 

________________________________

 

      From: Paul Hepworth [mailto:Paul.hepworth@detica.com] 

      Sent: Friday, October 24, 2008 5:00 AM

      To: user@xmlbeans.apache.org; dev@xmlbeans.apache.org

      Subject: XmlBeans and Synchronization

      

      

 

      Hi (included dev list as this may be too in depth for the user list)

 

       

 

      I'm using XmlBeans 2.3.0 in a Weblogic 9.2 J2EE web application (JVM 1.5.0_10). \
We use XmlBeans

to compile our schema and these effectively become our domain objects. These are \
looked up

from the DB, stored in the Http Session, manipulated from the UI and passed to the DB \
again.

 

       

 

      The application appears to run fine with a single user, however when we test it \
with multiple

users using LoadRunner, we hit issues.

 

       

 

      What we are seeing is that we're getting stuck threads with the following \
stack:

 

      at java.lang.Object.wait(Native Method)

 

      - waiting on <0xd4a816e8> (a org.apache.xmlbeans.impl.common.Mutex)

 

      at java.lang.Object.wait(Object.java:474)

 

      at org.apache.xmlbeans.impl.common.Mutex.acquire(Mutex.java:33)

 

      - locked <0xd4a816e8> (a org.apache.xmlbeans.impl.common.Mutex)

 

      at org.apache.xmlbeans.impl.common.GlobalLock.acquire(GlobalLock.java:27)

 

      at org.apache.xmlbeans.impl.values.XmlObjectBase.set(XmlObjectBase.java:1944)

 

      at ...MyClassImpl.setMyValue(...)

 

       

 

      Can anyone shed any light on why this may happen?

 

       

 

      More specifically, does anyone know what the synchronisation strategy is in \
XmlBeans. From

my investigation, the GlobalLock uses a static Mutex, which means that if an instance \
needs

to take out more than 1 lock, it attempts to acquire a GlobalLock and will \
subsequently lock

out all other threads in the JVM from making any changes to an XmlObject.

 

       

 

      If that's the case, it seems very strange that making an update to 1 instance \
of an XmlObject

would lock out all other threads form updating any other instance of an XmlObject. I \
would

have thought that the synchronisation would have solely been around the instance \
itself.

 

       

 

      We have also seen the same issues that have been recorded here: \
https://issues.apache.org/jira/browse/XMLBEANS-328

 

       

 

      Any help on this would be much appreciated as it's causing major issues!!

 

      Thanks

 

      Paul

 

      

      

      

      This message should be regarded as confidential. If you have received this \
email in error

please notify the sender and destroy it immediately.

      Statements of intent shall only become binding when confirmed in hard copy by \
an authorised

signatory. The contents of this email may relate to dealings with other companies \
within the

Detica Group plc group of companies.

      

      Detica Limited is registered in England under No: 1337451.

      

      Registered offices: Surrey Research Park, Guildford, Surrey, GU2 7YP, England.


[Attachment #3 (text/html)]

<html xmlns:v="urn:schemas-microsoft-com:vml" \
xmlns:o="urn:schemas-microsoft-com:office:office" \
xmlns:w="urn:schemas-microsoft-com:office:word" \
xmlns:st1="urn:schemas-microsoft-com:office:smarttags" \
xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<title>Normal</title>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="PostalCode"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="City"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="PlaceType"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="PlaceName"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="place"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="country-region"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="PersonName"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
	{font-family:"Lucida Sans";
	panose-1:2 11 6 2 3 5 4 2 2 4;}
@font-face
	{font-family:Tahoma;
	panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
	{font-family:"Book Antiqua";
	panose-1:2 4 6 2 5 3 5 3 3 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:11.0pt;
	font-family:"Book Antiqua";}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{color:purple;
	text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:10.0pt;
	font-family:"Courier New";}
p.Code, li.Code, div.Code
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:10.0pt;
	font-family:"Lucida Sans";
	color:navy;}
p.code0, li.code0, div.code0
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:10.0pt;
	font-family:"Lucida Sans";
	color:navy;}
span.EmailStyle20
	{mso-style-type:personal;
	font-family:Arial;
	color:navy;}
span.EmailStyle21
	{mso-style-type:personal;
	font-family:Tahoma;
	color:blue;
	font-weight:normal;
	font-style:normal;
	text-decoration:none none;}
span.EmailStyle22
	{mso-style-type:personal-reply;
	font-family:Arial;
	color:navy;}
@page Section1
	{size:595.3pt 841.9pt;
	margin:1.0in 69.6pt 1.0in 69.6pt;}
div.Section1
	{page:Section1;}
 /* List Definitions */
 @list l0
	{mso-list-id:477574721;
	mso-list-type:hybrid;
	mso-list-template-ids:213700412 -1231365104 67698713 67698715 67698703 67698713 \
67698715 67698703 67698713 67698715;} @list l0:level1
	{mso-level-text:"%1\)";
	mso-level-tab-stop:21.0pt;
	mso-level-number-position:left;
	margin-left:21.0pt;
	text-indent:-.25in;}
@list l0:level2
	{mso-level-tab-stop:1.0in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l0:level3
	{mso-level-tab-stop:1.5in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l0:level4
	{mso-level-tab-stop:2.0in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l0:level5
	{mso-level-tab-stop:2.5in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l0:level6
	{mso-level-tab-stop:3.0in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l0:level7
	{mso-level-tab-stop:3.5in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l0:level8
	{mso-level-tab-stop:4.0in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l0:level9
	{mso-level-tab-stop:4.5in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l1
	{mso-list-id:1448502911;
	mso-list-type:hybrid;
	mso-list-template-ids:-1707458270 134807567 134807575 134807579 134807567 134807577 \
134807579 134807567 134807577 134807579;} @list l1:level1
	{mso-level-tab-stop:.5in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l1:level2
	{mso-level-number-format:alpha-lower;
	mso-level-text:"%2\)";
	mso-level-tab-stop:1.0in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l1:level3
	{mso-level-number-format:roman-lower;
	mso-level-tab-stop:1.5in;
	mso-level-number-position:right;
	text-indent:-9.0pt;}
@list l1:level4
	{mso-level-tab-stop:2.0in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l1:level5
	{mso-level-tab-stop:2.5in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l1:level6
	{mso-level-tab-stop:3.0in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l1:level7
	{mso-level-tab-stop:3.5in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l1:level8
	{mso-level-tab-stop:4.0in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l1:level9
	{mso-level-tab-stop:4.5in;
	mso-level-number-position:left;
	text-indent:-.25in;}
ol
	{margin-bottom:0in;}
ul
	{margin-bottom:0in;}
-->
</style>

</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>You&#8217;re right Paul, using setXXX
methods like you describer can get to a deadlock. We&#8217;re working on a fix
for this.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Cezar<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<div style='border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt'>

<div>

<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt;font-family:"Times New Roman"'>

<hr size=2 width="100%" align=center tabindex=-1>

</span></font></div>

<p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'> Paul Hepworth
[mailto:Paul.hepworth@detica.com] <br>
<b><span style='font-weight:bold'>Sent:</span></b> Thursday, October 30, 2008
3:42 AM<br>
<b><span style='font-weight:bold'>To:</span></b> <st1:PersonName \
w:st="on">dev@xmlbeans.apache.org</st1:PersonName>; <st1:PersonName \
w:st="on">cezar.andrei@oracle.com</st1:PersonName><br> <b><span \
style='font-weight:bold'>Subject:</span></b> RE: RE: XmlBeans and \
Synchronization</span></font><font size=3 face="Times New Roman"><span \
style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></font></p>

</div>

<p class=MsoNormal><font size=2 face="Book Antiqua"><span style='font-size:
11.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=blue face=Tahoma><span lang=EN-GB
style='font-size:10.0pt;font-family:Tahoma;color:blue'>Hi \
Cezar<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=blue face=Tahoma><span lang=EN-GB
style='font-size:10.0pt;font-family:Tahoma;color:blue'><o:p>&nbsp;</o:p></span></font></p>


<p class=MsoNormal><font size=2 color=blue face=Tahoma><span lang=EN-GB
style='font-size:10.0pt;font-family:Tahoma;color:blue'>The deadlock isn&#8217;t
happening because of code in XmlObjectBase, but rather because of generated
code from the schema.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=blue face=Tahoma><span lang=EN-GB
style='font-size:10.0pt;font-family:Tahoma;color:blue'><o:p>&nbsp;</o:p></span></font></p>


<p class=MsoNormal><font size=2 color=blue face=Tahoma><span lang=EN-GB
style='font-size:10.0pt;font-family:Tahoma;color:blue'>So when I compile our
schema, if I look at any setXXX(&#8230;) method in the generated sources, it
synchronizes on its monitor first.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=blue face=Tahoma><span lang=EN-GB
style='font-size:10.0pt;font-family:Tahoma;color:blue'><o:p>&nbsp;</o:p></span></font></p>


<p class=MsoNormal><font size=2 color=blue face=Tahoma><span lang=EN-GB
style='font-size:10.0pt;font-family:Tahoma;color:blue'>There is then a call to
check_orphaned(), followed by a call to get_store().find_element_user(&#8230;)
(or add_element_user(&#8230;) if it&#8217;s not in the store), and finally a
call to set(&#8230;) which ends up in the XmlObjectBase set method, which will
then do as you&#8217;ve described. <o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=blue face=Tahoma><span lang=EN-GB
style='font-size:10.0pt;font-family:Tahoma;color:blue'><o:p>&nbsp;</o:p></span></font></p>


<p class=MsoNormal><font size=2 color=blue face=Tahoma><span lang=EN-GB
style='font-size:10.0pt;font-family:Tahoma;color:blue'>The issue that is
causing the deadlock is that the generated code has already synchronized on the
monitor (step 1a in my mail).<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=blue face=Tahoma><span lang=EN-GB
style='font-size:10.0pt;font-family:Tahoma;color:blue'><o:p>&nbsp;</o:p></span></font></p>


<p class=MsoNormal><font size=2 color=blue face=Tahoma><span lang=EN-GB
style='font-size:10.0pt;font-family:Tahoma;color:blue'>Thanks<o:p></o:p></span></font></p>


<p class=MsoNormal><font size=2 color=blue face=Tahoma><span lang=EN-GB
style='font-size:10.0pt;font-family:Tahoma;color:blue'>Paul<o:p></o:p></span></font></p>


<p class=MsoNormal><font size=2 color=blue face=Tahoma><span lang=EN-GB
style='font-size:10.0pt;font-family:Tahoma;color:blue'><o:p>&nbsp;</o:p></span></font></p>


<div>

<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt;font-family:"Times New Roman"'>

<hr size=2 width="100%" align=center tabindex=-1>

</span></font></div>

<p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'> Cezar Andrei
[mailto:<st1:PersonName w:st="on">cezar.andrei@oracle.com</st1:PersonName>] <br>
<b><span style='font-weight:bold'>Sent:</span></b> 29 October 2008 21:08<br>
<b><span style='font-weight:bold'>To:</span></b> <st1:PersonName \
w:st="on">dev@xmlbeans.apache.org</st1:PersonName><br> <b><span \
style='font-weight:bold'>Subject:</span></b> RE: RE: XmlBeans and \
Synchronization</span></font><font size=3 face="Times New Roman"><span \
style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></font></p>

</div>

<p class=MsoNormal><font size=2 face="Book Antiqua"><span lang=EN-GB
style='font-size:11.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Paul, <o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Actually the code that does the set()
synchronization is the following (see \
XmlObjectBase:2048):<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& \
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 // about to grab two locks: don't deadlock ourselves<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& \
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 GlobalLock.acquire();<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& \
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 acquired = true;<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& \
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 synchronized (monitor())<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& \
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 {<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& \
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 synchronized (obj.monitor())<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& \
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 {<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& \
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 GlobalLock.release();<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& \
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 acquired = false;<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& \
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 newObj = setterHelper( obj );<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& \
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 }<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& \
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 }<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>There are 3 places where a thread can get
stuck: <o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:21.0pt;text-indent:-.25in;mso-list:l0 level1 \
lfo2'><![if !supportLists]><font size=2 color=navy face=Arial><span \
style='font-size:10.0pt;font-family:Arial; color:navy'><span \
style='mso-list:Ignore'>1)<font size=1 face="Times New Roman"><span style='font:7.0pt \
"Times New Roman"'>&nbsp;&nbsp; </span></font></span></span></font><![endif]><font \
size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:Arial; \
color:navy'>before </span></font><font size=2 color=navy face="Courier New"><span \
style='font-size:10.0pt;font-family:"Courier \
New";color:navy'>GlobalLock.acquire():</span></font><font size=2 color=navy \
face=Arial><span style='font-size:10.0pt;font-family:Arial; color:navy'> Since \
it&#8217;s a GlobalLock, only one thread can run between </span></font><font size=2 \
color=navy face="Courier New"><span style='font-size:10.0pt;font-family: "Courier \
New";color:navy'>GlobalLock.acquire(); </span></font><font size=2 color=navy \
face=Arial><span style='font-size:10.0pt;font-family:Arial; \
color:navy'>and</span></font><font size=2 color=navy face="Courier New"><span \
style='font-size:10.0pt;font-family:"Courier New";color:navy'> \
GlobalLock.release();</span></font><font size=2 color=navy face=Arial><span \
style='font-size:10.0pt;font-family:Arial;color:navy'> at one \
time.<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:21.0pt;text-indent:-.25in;mso-list:l0 level1 \
lfo2'><![if !supportLists]><font size=2 color=navy face=Arial><span \
style='font-size:10.0pt;font-family:Arial; color:navy'><span \
style='mso-list:Ignore'>2)<font size=1 face="Times New Roman"><span style='font:7.0pt \
"Times New Roman"'>&nbsp;&nbsp; </span></font></span></span></font><![endif]><font \
size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:Arial; \
color:navy'>Before </span></font><font size=2 color=navy face="Courier New"><span \
style='font-size:10.0pt;font-family:"Courier New";color:navy'>synchronized \
(monitor())</span></font><font size=2 color=navy face=Arial><span \
style='font-size:10.0pt;font-family:Arial;color:navy'>: which means that another \
thread is doing something on this object, but since the other thread doesn&#8217;t \
have the global lock, it means that the other thread should have everything needed to \
finish its operation.<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:21.0pt;text-indent:-.25in;mso-list:l0 level1 \
lfo2'><![if !supportLists]><font size=2 color=navy face=Arial><span \
style='font-size:10.0pt;font-family:Arial; color:navy'><span \
style='mso-list:Ignore'>3)<font size=1 face="Times New Roman"><span style='font:7.0pt \
"Times New Roman"'>&nbsp;&nbsp; </span></font></span></span></font><![endif]><font \
size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:Arial; \
color:navy'>Before </span></font><font size=2 color=navy face="Courier New"><span \
style='font-size:10.0pt;font-family:"Courier New";color:navy'>synchronized \
(obj.monitor()):</span></font><font size=2 color=navy face=Arial><span \
style='font-size:10.0pt;font-family:Arial;color:navy'> same as before but on the \
second object.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Assuming that the application that is
using XMLBeans doesn&#8217;t use GlobalLock, or uses some other external
synchronization, I don&#8217;t see how a deadlock could happen in your
scenario.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Cezar<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<div style='border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt'>

<div>

<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt;font-family:"Times New Roman"'>

<hr size=2 width="100%" align=center tabindex=-1>

</span></font></div>

<p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'> <st1:PersonName
w:st="on">Paul Hepworth</st1:PersonName> [mailto:Paul.hepworth@detica.com] <br>
<b><span style='font-weight:bold'>Sent:</span></b> Wednesday, October 29, 2008
11:37 AM<br>
<b><span style='font-weight:bold'>To:</span></b> <st1:PersonName \
w:st="on">dev@xmlbeans.apache.org</st1:PersonName><br> <b><span \
style='font-weight:bold'>Subject:</span></b> RE: RE: XmlBeans and \
Synchronization</span></font><font size=3 face="Times New Roman"><span \
style='font-size:12.0pt;font-family:"Times New Roman"'><o:p></o:p></span></font></p>

</div>

<p class=MsoNormal><font size=2 face="Book Antiqua"><span style='font-size:
11.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>All<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>I believe I have found a defect with XmlBeans which
can cause a deadlock to occur under a specific \
situation.<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>The situation can occur when calling a setter on an
Object which synchronizes on Locale A, to set an Object which synchronizes on
Locale B at the same time as calling a setter on an Object which synchronizes
on Locale B to set an Object which synchronizes on Locale \
A.<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>The code which XmlBeans generates follows this \
flow:<o:p></o:p></span></font></p>

<p class=MsoPlainText style='margin-left:.5in;text-indent:-.25in;mso-list:l1 level1 \
lfo4'><![if !supportLists]><font size=2 face="Courier New"><span lang=EN-GB \
style='font-size:10.0pt'><span style='mso-list:Ignore'>1.<font size=1 face="Times New \
Roman"><span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp; \
</span></font></span></span></font><![endif]><span \
lang=EN-GB>MyObjectUnderLocaleA.setMyElement(MyObjectUnderLocaleB)<o:p></o:p></span></p>


<p class=MsoPlainText style='margin-left:1.0in;text-indent:-.25in;mso-list:
l1 level2 lfo4'><![if !supportLists]><font size=2 face="Courier New"><span
lang=EN-GB style='font-size:10.0pt'><span style='mso-list:Ignore'>a)<font
size=1 face="Times New Roman"><span style='font:7.0pt "Times New \
Roman"'>&nbsp;&nbsp;&nbsp; </span></font></span></span></font><![endif]><span \
lang=EN-GB>Synchronize on monitor()<o:p></o:p></span></p>

<p class=MsoPlainText style='margin-left:1.0in;text-indent:-.25in;mso-list:
l1 level2 lfo4'><![if !supportLists]><font size=2 face="Courier New"><span
lang=EN-GB style='font-size:10.0pt'><span style='mso-list:Ignore'>b)<font
size=1 face="Times New Roman"><span style='font:7.0pt "Times New \
Roman"'>&nbsp;&nbsp;&nbsp; </span></font></span></span></font><![endif]><span \
lang=EN-GB>Delegates to XmlObjectBase.set(XmlObject src)<o:p></o:p></span></p>

<p class=MsoPlainText \
                style='margin-left:1.5in;text-indent:-1.5in;mso-text-indent-alt:
-9.0pt;mso-list:l1 level3 lfo4'><![if !supportLists]><font size=2
face="Courier New"><span lang=EN-GB style='font-size:10.0pt'><span
style='mso-list:Ignore'><font size=1 face="Times New Roman"><span
style='font:7.0pt "Times New \
Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n \
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs \
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 </span></font>i.<font size=1 face="Times New Roman"><span style='font:7.0pt "Times \
New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
</span></font></span></span></font><![endif]><span lang=EN-GB>Identifies that \
MyObjectUnderLocaleA.monitor() != \
MyObjectUnderLocaleB.monitor()<o:p></o:p></span></p>

<p class=MsoPlainText \
                style='margin-left:1.5in;text-indent:-1.5in;mso-text-indent-alt:
-9.0pt;mso-list:l1 level3 lfo4'><![if !supportLists]><font size=2
face="Courier New"><span lang=EN-GB style='font-size:10.0pt'><span
style='mso-list:Ignore'><font size=1 face="Times New Roman"><span
style='font:7.0pt "Times New \
Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n \
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs \
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 </span></font>ii.<font size=1 face="Times New Roman"><span style='font:7.0pt "Times \
New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
</span></font></span></span></font><![endif]><span \
lang=EN-GB>GlobalLock.acquire<o:p></o:p></span></p>

<p class=MsoPlainText \
                style='margin-left:1.5in;text-indent:-1.5in;mso-text-indent-alt:
-9.0pt;mso-list:l1 level3 lfo4'><![if !supportLists]><font size=2
face="Courier New"><span lang=EN-GB style='font-size:10.0pt'><span
style='mso-list:Ignore'><font size=1 face="Times New Roman"><span
style='font:7.0pt "Times New \
Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n \
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs \
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 </span></font>iii.<font size=1 face="Times New Roman"><span style='font:7.0pt "Times \
New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
</span></font></span></span></font><![endif]><span lang=EN-GB>Synchronize on \
monitor()<o:p></o:p></span></p>

<p class=MsoPlainText \
                style='margin-left:1.5in;text-indent:-1.5in;mso-text-indent-alt:
-9.0pt;mso-list:l1 level3 lfo4'><![if !supportLists]><font size=2
face="Courier New"><span lang=EN-GB style='font-size:10.0pt'><span
style='mso-list:Ignore'><font size=1 face="Times New Roman"><span
style='font:7.0pt "Times New \
Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n \
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs \
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 </span></font>iv.<font size=1 face="Times New Roman"><span style='font:7.0pt "Times \
New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
</span></font></span></span></font><![endif]><span lang=EN-GB>Synchronize on \
MyObjectUnderLocaleB.monitor()<o:p></o:p></span></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>So if the reverse is happening concurrently, Thread 1
will have a lock on Locale A and the GlobalLock, and Thread 2 will have a lock
on Locale B and wait to get the GlobalLock &#8211; hence the deadlock
situation.<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>It may be that this is arising from a
strange/undesired use of XmlBeans - we have a HashMap which caches template
XmlBean objects, and when we need an instance of the template, we were calling
the copy() method and returning that. I believe this means the template and our
instance share the same locale. Once the number of users ramps up, there are a
lot of users sharing the same locale and consequently introducing a lot of
contention.<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>We have worked around the problem for now by
performing an XmlObject.Factory.parse(...) and so each returned object is then
in its own Locale.<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>If someone can confirm this, can it be raised as a
defect? If it&#8217;s not a defect, then is there a way to do a deep copy that
will create the new object in a new Locale?<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>Thanks<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>Paul<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span style='font-size:
10.0pt'>-----Original Message-----<br>
From: <st1:PersonName w:st="on">Paul Hepworth</st1:PersonName> <br>
Sent: 27 October 2008 14:28<br>
To: <st1:PersonName w:st="on">'<st1:PersonName \
                w:st="on">dev@xmlbeans.apache.org</st1:PersonName>'</st1:PersonName><br>
                
Subject: RE: XmlBeans and Synchronization</span></font><span \
lang=EN-GB><o:p></o:p></span></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>Hi Radu<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>Thanks for the explanation. In theory it all seems
sound. Only our application is getting itself locked \
somehow.<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>I've done a thread-dump from Weblogic, and have
multiple threads waiting on XmlObjectBase.java:1944 which is fine and to be
expected as per your explanation.<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>I then have another thread which is stuck on
XmlObjectBase.java:1949 - so this is the one that has the GlobalLock, but is in
turn waiting on another lock which isn't getting released at \
all.<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>I have several other threads that are blocked on
XmlObjectBase.java:116 performing a copy which I believe are fine and just
waiting for a lock.<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>I then have a few threads performing simple gets that
are blocked waiting for locks on Locale.<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>I have no other threads that are doing any processing
(I've left the app in this state for 10 or so minutes and all the threads are
just locked up)<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>As I can't find much info on the net, could you
explain a bit more about the Local please? <o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>What I'd like to know is the \
following:<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - Is there a new Local
per instance of a document or a shared one for all instances of the same type?
i.e. if I call MyDocument.Factory.newInstance(), does this get a new Local each
time, or 1 shared one for all MyDocument instances?<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - We have a template
service that reads and parses XML stored in the DB, this is cached for
performance reasons, and when we request a template, we call the copy() method.
Does this mean that each copied instance shares the same Locale? If that's the
case, this will greatly impact the performance of our \
app.<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - Basically... what
determines the Locale?<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>Additionally, you mention turning off
synchronisation... I've attempted this in the code using XmlBeans 2.3.0 and run
into the problems mentioned here:
https://issues.apache.org/jira/browse/XMLBEANS-328 it should also be noted that
we were having these errors in our performance test environment originally and
applied the patch mentioned. This stopped the errors described, however we were
still running into the deadlock situation.<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>Is this something which has been fixed in 2.4? Is it a
safe option to turn off synchronisation?<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>Any help greatly appreciated!<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>Thanks<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>Paul<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>Hi Paul,<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>&nbsp;<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>I can tell you what the synchronization strategy is.
Each XmlObject belongs to an xml document,<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>and each xml document belongs to what XmlBeans calls a
Locale object (nothing to do with the<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>Java Locale). This is the synchronization domain for
XmlBeans. When doing a set, there are<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>two XmlObjects involved: the source (the parameter of
the &quot;set&quot; method) and the target (the<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>object you're calling &quot;set&quot; on). XMLBeans
requires that they both be synchronized. Now, if<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>the synchronization domain for the two is the same
(the same Locale object), then there's<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>no problem (see check at XmlObjectBase.java:1934 if
you have the 2.3.0 source). But if the<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>synchronization domain is not the same, then it means
that two locks must be acquired and<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>so there is a possibility for deadlock. In order to
avoid the deadlock, XMLBeans has the \
&quot;GlobalLock&quot;.<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>This global lock is held only for as long as it is
necessary to acquire the two XmlObject<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>locks and then it is immediately released. This guards
against the deadlock, but doesn't guard<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>against the possibility that one thread grabs the
global lock and then blocks on waiting for<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>another thread to finish with one of the XmlObject
locks it is trying to acquire. Eventually,<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>it will grab the lock it is waiting for and then
release the Global lock, but while it is<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>waiting, all the other threads in the whole system are
prevented from initiating a set that<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>requires two locks, which can be a \
problem.<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>&nbsp;<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>So I think first of all, it would be interesting for
you to look at the stack traces for all<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>the threads to confirm my scenario above. Then, as far
as solution, the only reliable one<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>that I know of is not use the &quot;setMyValue&quot;
method and replace it with &quot;addNewMyValue&quot; \
whenever<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>possible because it doesn't require synchronization
(and the overall performance is better).<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>In XMLBeans 2.4.0, I think, removing synchronization \
altogether from the XMLBeans layer would<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>also solve the problem.<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>&nbsp;<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>Radu<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>________________________________<o:p></o:p></span></font></p>


<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; From: <st1:PersonName
w:st="on">Paul Hepworth</st1:PersonName> [mailto:Paul.hepworth@detica.com] \
<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Sent: Friday, October
24, 2008 5:00 AM<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; To: <st1:PersonName
w:st="on">user@xmlbeans.apache.org</st1:PersonName>; <st1:PersonName \
w:st="on">dev@xmlbeans.apache.org</st1:PersonName><o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Subject: XmlBeans and
Synchronization<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Hi (included dev list
as this may be too in depth for the user list)<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
&nbsp;<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; I'm using XmlBeans
2.3.0 in a Weblogic 9.2 J2EE web application (JVM 1.5.0_10). We use \
XmlBeans<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>to compile our schema and these effectively become our
domain objects. These are looked up<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>from the DB, stored in the Http Session, manipulated
from the UI and passed to the DB again.<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
&nbsp;<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The application appears
to run fine with a single user, however when we test it with \
multiple<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>users using LoadRunner, we hit \
issues.<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
&nbsp;<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; What we are seeing is
that we're getting stuck threads with the following \
stack:<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at \
java.lang.Object.wait(Native Method)<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - waiting on
&lt;0xd4a816e8&gt; (a \
org.apache.xmlbeans.impl.common.Mutex)<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
java.lang.Object.wait(Object.java:474)<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
org.apache.xmlbeans.impl.common.Mutex.acquire(Mutex.java:33)<o:p></o:p></span></font></p>


<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - locked
&lt;0xd4a816e8&gt; (a \
org.apache.xmlbeans.impl.common.Mutex)<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
org.apache.xmlbeans.impl.common.GlobalLock.acquire(GlobalLock.java:27)<o:p></o:p></span></font></p>


<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
org.apache.xmlbeans.impl.values.XmlObjectBase.set(XmlObjectBase.java:1944)<o:p></o:p></span></font></p>


<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
...MyClassImpl.setMyValue(...)<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
&nbsp;<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Can anyone shed any
light on why this may happen?<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
&nbsp;<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; More specifically, does
anyone know what the synchronisation strategy is in XmlBeans. \
From<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>my investigation, the GlobalLock uses a static Mutex,
which means that if an instance needs<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>to take out more than 1 lock, it attempts to acquire a
GlobalLock and will subsequently lock<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>out all other threads in the JVM from making any
changes to an XmlObject.<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
&nbsp;<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If that's the case, it
seems very strange that making an update to 1 instance of an \
XmlObject<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>would lock out all other threads form updating any
other instance of an XmlObject. I would<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>have thought that the synchronisation would have
solely been around the instance itself.<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
&nbsp;<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; We have also seen the
same issues that have been recorded here:
https://issues.apache.org/jira/browse/XMLBEANS-328<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
&nbsp;<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Any help on this would
be much appreciated as it's causing major issues!!<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
Thanks<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
Paul<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; This message should be
regarded as confidential. If you have received this email in \
error<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>please notify the sender and destroy it \
immediately.<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Statements of intent
shall only become binding when confirmed in hard copy by an \
authorised<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>signatory. The contents of this email may relate to
dealings with other companies within the<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>Detica Group plc group of \
companies.<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Detica Limited is
registered in <st1:place w:st="on"><st1:country-region \
w:st="on">England</st1:country-region></st1:place> under No: \
1337451.<o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <o:p></o:p></span></font></p>

<p class=MsoPlainText><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Registered offices: \
<st1:PlaceName w:st="on">Surrey</st1:PlaceName> <st1:PlaceName \
w:st="on">Research</st1:PlaceName> <st1:PlaceType w:st="on">Park</st1:PlaceType>, \
Guildford, <st1:place w:st="on"><st1:City  w:st="on">Surrey</st1:City>, \
<st1:PostalCode w:st="on">GU2 7YP</st1:PostalCode>,  <st1:country-region \
w:st="on">England</st1:country-region></st1:place>.<o:p></o:p></span></font></p>

</div>

</div>

</div>

</body>

</html>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic