You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xmlbeans.apache.org by "Gordon Eastman (JIRA)" <xm...@xml.apache.org> on 2006/12/05 19:49:24 UTC
[jira] Created: (XMLBEANS-300) Threading issue leads to NPE in
SchemaComponent$Ref.getComponent
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
[jira] Updated: (XMLBEANS-300) Threading issue leads to NPE in
SchemaComponent$Ref.getComponent
Posted by "Gordon Eastman (JIRA)" <xm...@xml.apache.org>.
[ http://issues.apache.org/jira/browse/XMLBEANS-300?page=all ]
Gordon Eastman updated XMLBEANS-300:
------------------------------------
Description:
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 document, 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.
was:
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.
> 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 document, 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
[jira] Resolved: (XMLBEANS-300) Threading issue leads to NPE in
SchemaComponent$Ref.getComponent
Posted by "Radu Preotiuc-Pietro (JIRA)" <xm...@xml.apache.org>.
[ https://issues.apache.org/jira/browse/XMLBEANS-300?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Radu Preotiuc-Pietro resolved XMLBEANS-300.
-------------------------------------------
Resolution: Fixed
Fix Version/s: Version 2.3
Fixed with svn revision 529824.
> Threading issue leads to NPE in SchemaComponent$Ref.getComponent
> ----------------------------------------------------------------
>
> Key: XMLBEANS-300
> URL: https://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
> Fix For: Version 2.3
>
> Attachments: XMLBEANS-300.patch.txt
>
>
> 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 document, 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.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org
[jira] Updated: (XMLBEANS-300) Threading issue leads to NPE in
SchemaComponent$Ref.getComponent
Posted by "Ben La Monica (JIRA)" <xm...@xml.apache.org>.
[ https://issues.apache.org/jira/browse/XMLBEANS-300?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ben La Monica updated XMLBEANS-300:
-----------------------------------
Attachment: XMLBEANS-300.patch.txt
This has happened to me on a MP Solaris 8 box as well with XmlBeans 2.2.0.
Here is a patch that will synchronize this code. I agree with Gordon's assessment, the NPE is happening when two threads try to get the component at the same time when the component has not yet been resolved.
I chose to synchronize on a private member instead of the class, but the maintainer will know better than I the correct way to synchronize this.
> Threading issue leads to NPE in SchemaComponent$Ref.getComponent
> ----------------------------------------------------------------
>
> Key: XMLBEANS-300
> URL: https://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
> Attachments: XMLBEANS-300.patch.txt
>
>
> 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 document, 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.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org