[prev in list] [next in list] [prev in thread] [next in thread]
List: xmlbeans-dev
Subject: [jira] Created: (XMLBEANS-300) Threading issue leads to NPE in
From: "Gordon Eastman (JIRA)" <xmlbeans-dev () xml ! apache ! org>
Date: 2006-12-05 18:49:24
Message-ID: 23889068.1165344564987.JavaMail.jira () brutus
[Download RAW message or body]
Threading issue leads to NPE in SchemaComponent$Ref.getComponent
----------------------------------------------------------------
Key: XMLBEANS-300
URL: http://issues.apache.org/jira/browse/XMLBEANS-300
Project: XMLBeans
Issue Type: Bug
Components: XmlObject
Affects Versions: Version 2, Version 2.1, Version 2.2
Reporter: Gordon Eastman
We have seen this NPE during normal use of our application on a MP Solaris system \
using XmlBeans 2.0.0. I tested and confirmed it is still a problem in 2.2.0:
java.lang.NullPointerException
at org.apache.xmlbeans.SchemaComponent$Ref.getComponent(SchemaComponent.java:104)
at org.apache.xmlbeans.SchemaType$Ref.get(SchemaType.java:872)
at org.apache.xmlbeans.impl.schema.SchemaPropertyImpl.getType(SchemaPropertyImpl.java:92)
at org.apache.xmlbeans.impl.schema.SchemaTypeImpl.createElementType(SchemaTypeImpl.java:965)
at org.apache.xmlbeans.impl.values.XmlObjectBase.create_element_user(XmlObjectBase.java:895)
at org.apache.xmlbeans.impl.store.Xobj.getUser(Xobj.java:1592)
at org.apache.xmlbeans.impl.store.Cur.getUser(Cur.java:2627)
at org.apache.xmlbeans.impl.store.Cur.getObject(Cur.java:2620)
at org.apache.xmlbeans.impl.store.Cursor._getObject(Cursor.java:983)
at org.apache.xmlbeans.impl.store.Cursor.getObject(Cursor.java:2896)
Here is how to reproduce with the debugger:
- start two threads, each of which loads a different xml document with the same \
schema type
- each thread will traverse its socument, calling getObject at each element
- break before traversal starts
- insert breakpoint at SchemaComponent.java:104, and let both threads run to this \
point
- resume one thread, and then the other
- the second thread fails with the NPE
Here is the code fragment from SchemaComponent $Ref:
public final SchemaComponent getComponent()
{
if (_schemaComponent == null && _handle != null)
{
_schemaComponent = _schemaTypeSystem.resolveHandle(_handle); // this \
is line 104 _schemaTypeSystem = null;
}
return _schemaComponent;
}
Both threads use the same Ref object, and there is no protection between use of \
_schemaTypeSystem on line 104 and setting it null on the next line
I do not know enough about how thread protection of schema types is designed to know \
if a localized fix to synchronize the lazy instantiation is appropriate, or if \
synchronization at a higher level is appropriate.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: \
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic