You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Royi Ronen (JIRA)" <ji...@apache.org> on 2008/09/09 21:35:44 UTC
[jira] Created: (DERBY-3870) Concurrent Inserts of rows with XML
data results in an exception
Concurrent Inserts of rows with XML data results in an exception
----------------------------------------------------------------
Key: DERBY-3870
URL: https://issues.apache.org/jira/browse/DERBY-3870
Project: Derby
Issue Type: Bug
Components: SQL
Affects Versions: 10.4.1.3
Environment: System: MS windows server 2003 standard edition service pack 2. Derby is run as a server on port 1527.
Reporter: Royi Ronen
Priority: Critical
We insert rows into a table using the following prepared statement (through JDBC):
INSERT INTO USER1.PSTORE values(?,?, XMLPARSE(document CAST (? AS CLOB) preserve whitespace))
where each of the ?'s are replaced with a string.
One thread runs fine. Two or more result in the following exception:
org.apache.derby.client.am.SqlException: Java exception: 'FWK005 parse may not be called while parsing.: org.xml.sax.SAXException'.
at org.apache.derby.client.am.SqlException.<init>(Unknown Source)
at org.apache.derby.client.am.SqlException.<init>(Unknown Source)
We believe that this comes from the dBuilder.parse(InputSource) method.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DERBY-3870) Concurrent Inserts of rows with XML
data results in an exception
Posted by "Aleksander Slominski (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-3870?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12630674#action_12630674 ]
Aleksander Slominski commented on DERBY-3870:
---------------------------------------------
hi,
i was able to fix the problem :) i am attaching ZIP file that contains the fix and simple test that can be built with ant after lib directory is created and populated with derby / xerces/ xalan / serializer jars (see README.txt has details).
> What JDK and XML parser are you using?
mostly JDK 1.5 and relatively new xerces/xalan version - i could not find exactly which one by looking into jar file of xerces but xalan from MANIFEST.MF is 2.7.1
i tested with db-derby-10.4.1.3-bin and db-derby-10.4.2.0-bin and also built from SVN db-derby-snapshot-10.5.0.0-694562 - for all the the same error happens
> What sort of errors are in your derby.log file? Can you attach it?
this is typical exception - i am attaching derby log file
2008-09-11 21:25:55.453 GMT Thread[DRDAConnThread_7,5,main] (XID = 82480), (SESSIONID = 1), (DATABASE = sample), (DRDAID = NF000001.GD9D-449232841661851773{2}), Failed Statement is: INSERT INTO USER1.PSTORE values(?,?, XMLPARSE(document CAST (? AS CLOB) preserve whitespace)) with 3 parameters begin parameter #1: 1_0 :end parameter begin parameter #2: 1abcde0 :end parameter begin parameter #3: CLOB(826) :end parameter
ERROR 2200M: Invalid XML DOCUMENT: FWK005 parse may not be called while parsing.
at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
at org.apache.derby.iapi.types.XML.XMLParse(Unknown Source)
at org.apache.derby.impl.sql.execute.SqlXmlExecutor.XMLParse(Unknown Source)
at org.apache.derby.exe.acc851401ax011cx534ex27f7x00003f5c9d400.e0(Unknown Source)
at org.apache.derby.impl.services.reflect.DirectCall.invoke(Unknown Source)
at org.apache.derby.impl.sql.execute.RowResultSet.getNextRowCore(Unknown Source)
at org.apache.derby.impl.sql.execute.NormalizeResultSet.getNextRowCore(Unknown Source)
at org.apache.derby.impl.sql.execute.DMLWriteResultSet.getNextRowCore(Unknown Source)
at org.apache.derby.impl.sql.execute.InsertResultSet.open(Unknown Source)
at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement.execute(Unknown Source)
at org.apache.derby.impl.drda.DRDAStatement.execute(Unknown Source)
at org.apache.derby.impl.drda.DRDAConnThread.parseEXCSQLSTTobjects(Unknown Source)
at org.apache.derby.impl.drda.DRDAConnThread.parseEXCSQLSTT(Unknown Source)
at org.apache.derby.impl.drda.DRDAConnThread.processCommands(Unknown Source)
at org.apache.derby.impl.drda.DRDAConnThread.run(Unknown Source)
Caused by: org.xml.sax.SAXException: FWK005 parse may not be called while parsing.
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at org.apache.derby.iapi.types.SqlXmlUtil$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(AccessController.java:246)
at org.apache.derby.iapi.types.SqlXmlUtil.serializeToString(Unknown Source)
... 17 more
============= begin nested exception, level (1) ===========
org.xml.sax.SAXException: FWK005 parse may not be called while parsing.
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at org.apache.derby.iapi.types.SqlXmlUtil$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(AccessController.java:246)
at org.apache.derby.iapi.types.SqlXmlUtil.serializeToString(Unknown Source)
at org.apache.derby.iapi.types.XML.XMLParse(Unknown Source)
at org.apache.derby.impl.sql.execute.SqlXmlExecutor.XMLParse(Unknown Source)
at org.apache.derby.exe.acc851401ax011cx534ex27f7x00003f5c9d400.e0(Unknown Source)
at org.apache.derby.impl.services.reflect.DirectCall.invoke(Unknown Source)
at org.apache.derby.impl.sql.execute.RowResultSet.getNextRowCore(Unknown Source)
at org.apache.derby.impl.sql.execute.NormalizeResultSet.getNextRowCore(Unknown Source)
at org.apache.derby.impl.sql.execute.DMLWriteResultSet.getNextRowCore(Unknown Source)
at org.apache.derby.impl.sql.execute.InsertResultSet.open(Unknown Source)
at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement.execute(Unknown Source)
at org.apache.derby.impl.drda.DRDAStatement.execute(Unknown Source)
at org.apache.derby.impl.drda.DRDAConnThread.parseEXCSQLSTTobjects(Unknown Source)
at org.apache.derby.impl.drda.DRDAConnThread.parseEXCSQLSTT(Unknown Source)
at org.apache.derby.impl.drda.DRDAConnThread.processCommands(Unknown Source)
at org.apache.derby.impl.drda.DRDAConnThread.run(Unknown Source)
> Also, can you try extracting as much information as possible from
> the client-side exception by using the techniques described at
> http://wiki.apache.org/db-derby/UnwindExceptionChain
> then posting that information?
here it is:
server:
[java] preparing tables
[java] conn being returned is:org.apache.derby.client.net.NetConnection@b96
0b96
[java] tables preparation ended
[java] preparing XML to String
[java] preparing workers
[java] conn being returned is:org.apache.derby.client.net.NetConnection@668
06680
[java] conn being returned is:org.apache.derby.client.net.NetConnection@46c
046c
[java] starting 2 threads
[java] all insert threads started
[java]
[java] ----- SQLException -----
[java] SQLState: 2200M
[java] Error Code: -1
[java] Message: Invalid XML DOCUMENT: FWK005 parse may not be called w
hile parsing.
[java]
[java] ----- SQLException -----
[java] SQLState: XJ001
[java] Error Code: 99999
[java] Message: Java exception: 'FWK005 parse may not be called while
parsing.: org.xml.sax.SAXException'.
[java] Exception in thread "Thread-1" java.lang.RuntimeException: inserting
0 failed:null rawXML=<?xml version="1.0" encoding="UTF-8"?>
[java] <fn:filenetEvent pstore:class="custom" pstore:id="61"
[java] xmlns:fn="http://foo.var"
[java] xmlns:pstore="http://bar.var" >
[java] <pstore:appID>1abcde0</pstore:appID>
[java] <fn:documentID>5EE285D7-AF83-4B62-A2B5-BBB91FE2ADD4</fn:documentID
>
[java] <pstore:displayName>Email</pstore:displayName>
[java] <fn:to>lisa@maricopa.watson.ibm.com</fn:to>
[java] <fn:action>Creation</fn:action>
[java] <fn:timeStamp>Wed, 30 Jul 2008 18:33:00</fn:timeStamp>
[java] <fn:title>Loan application 101 customer response</fn:title>
[java] <fn:systemTimeStamp>1abcde00</fn:systemTimeStamp>
[java] <fn:from>chuck@maricopa.watson.ibm.com</fn:from>
[java] <fn:documentType>email</fn:documentType>
[java] <fn:subject>RE: WeFinance Loan Application 101</fn:subject>
[java] <fn:loanID>101</fn:loanID>
[java] <fn:actor>lisa</fn:actor>
[java] </fn:filenetEvent>
[java]
[java] at ThreadInsert.insertSome(Unknown Source)
[java] at ThreadInsert.run(Unknown Source)
[java] at java.lang.Thread.run(Thread.java:810)
> Concurrent Inserts of rows with XML data results in an exception
> ----------------------------------------------------------------
>
> Key: DERBY-3870
> URL: https://issues.apache.org/jira/browse/DERBY-3870
> Project: Derby
> Issue Type: Bug
> Components: SQL
> Affects Versions: 10.4.1.3
> Environment: System: MS windows server 2003 standard edition service pack 2. Derby is run as a server on port 1527.
> Reporter: Royi Ronen
> Priority: Critical
>
> We insert rows into a table using the following prepared statement (through JDBC):
> INSERT INTO USER1.PSTORE values(?,?, XMLPARSE(document CAST (? AS CLOB) preserve whitespace))
> where each of the ?'s are replaced with a string.
> One thread runs fine. Two or more result in the following exception:
> org.apache.derby.client.am.SqlException: Java exception: 'FWK005 parse may not be called while parsing.: org.xml.sax.SAXException'.
> at org.apache.derby.client.am.SqlException.<init>(Unknown Source)
> at org.apache.derby.client.am.SqlException.<init>(Unknown Source)
> We believe that this comes from the dBuilder.parse(InputSource) method.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (DERBY-3870) Concurrent Inserts of rows with XML
data results in an exception
Posted by "Aleksander Slominski (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-3870?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Aleksander Slominski updated DERBY-3870:
----------------------------------------
Attachment: Copy of derby.log
derby log showing error happening server side
> Concurrent Inserts of rows with XML data results in an exception
> ----------------------------------------------------------------
>
> Key: DERBY-3870
> URL: https://issues.apache.org/jira/browse/DERBY-3870
> Project: Derby
> Issue Type: Bug
> Components: SQL
> Affects Versions: 10.4.1.3
> Environment: System: MS windows server 2003 standard edition service pack 2. Derby is run as a server on port 1527.
> Reporter: Royi Ronen
> Priority: Critical
> Attachments: Copy of derby.log, DerbyMultiInsertXmlException.zip
>
>
> We insert rows into a table using the following prepared statement (through JDBC):
> INSERT INTO USER1.PSTORE values(?,?, XMLPARSE(document CAST (? AS CLOB) preserve whitespace))
> where each of the ?'s are replaced with a string.
> One thread runs fine. Two or more result in the following exception:
> org.apache.derby.client.am.SqlException: Java exception: 'FWK005 parse may not be called while parsing.: org.xml.sax.SAXException'.
> at org.apache.derby.client.am.SqlException.<init>(Unknown Source)
> at org.apache.derby.client.am.SqlException.<init>(Unknown Source)
> We believe that this comes from the dBuilder.parse(InputSource) method.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DERBY-3870) Concurrent Inserts of rows with XML
data results in an exception
Posted by "Bryan Pendleton (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-3870?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12629685#action_12629685 ]
Bryan Pendleton commented on DERBY-3870:
----------------------------------------
What sort of errors are in your derby.log file? Can you attach it?
Also, can you try extracting as much information as possible from
the client-side exception by using the techniques described at
http://wiki.apache.org/db-derby/UnwindExceptionChain
then posting that information?
What JDK and XML parser are you using?
> Concurrent Inserts of rows with XML data results in an exception
> ----------------------------------------------------------------
>
> Key: DERBY-3870
> URL: https://issues.apache.org/jira/browse/DERBY-3870
> Project: Derby
> Issue Type: Bug
> Components: SQL
> Affects Versions: 10.4.1.3
> Environment: System: MS windows server 2003 standard edition service pack 2. Derby is run as a server on port 1527.
> Reporter: Royi Ronen
> Priority: Critical
>
> We insert rows into a table using the following prepared statement (through JDBC):
> INSERT INTO USER1.PSTORE values(?,?, XMLPARSE(document CAST (? AS CLOB) preserve whitespace))
> where each of the ?'s are replaced with a string.
> One thread runs fine. Two or more result in the following exception:
> org.apache.derby.client.am.SqlException: Java exception: 'FWK005 parse may not be called while parsing.: org.xml.sax.SAXException'.
> at org.apache.derby.client.am.SqlException.<init>(Unknown Source)
> at org.apache.derby.client.am.SqlException.<init>(Unknown Source)
> We believe that this comes from the dBuilder.parse(InputSource) method.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (DERBY-3870) Concurrent Inserts of rows with XML
data results in an exception
Posted by "Aleksander Slominski (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-3870?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Aleksander Slominski updated DERBY-3870:
----------------------------------------
Attachment: DerbyMultiInsertXmlException.zip
regression test and fix for the issues
> Concurrent Inserts of rows with XML data results in an exception
> ----------------------------------------------------------------
>
> Key: DERBY-3870
> URL: https://issues.apache.org/jira/browse/DERBY-3870
> Project: Derby
> Issue Type: Bug
> Components: SQL
> Affects Versions: 10.4.1.3
> Environment: System: MS windows server 2003 standard edition service pack 2. Derby is run as a server on port 1527.
> Reporter: Royi Ronen
> Priority: Critical
> Attachments: DerbyMultiInsertXmlException.zip
>
>
> We insert rows into a table using the following prepared statement (through JDBC):
> INSERT INTO USER1.PSTORE values(?,?, XMLPARSE(document CAST (? AS CLOB) preserve whitespace))
> where each of the ?'s are replaced with a string.
> One thread runs fine. Two or more result in the following exception:
> org.apache.derby.client.am.SqlException: Java exception: 'FWK005 parse may not be called while parsing.: org.xml.sax.SAXException'.
> at org.apache.derby.client.am.SqlException.<init>(Unknown Source)
> at org.apache.derby.client.am.SqlException.<init>(Unknown Source)
> We believe that this comes from the dBuilder.parse(InputSource) method.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (DERBY-3870) Concurrent Inserts of rows with XML
data results in an exception
Posted by "Kristian Waagan (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-3870?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Kristian Waagan updated DERBY-3870:
-----------------------------------
Priority: Major (was: Critical)
Issue & fix info: [Known fix, Repro attached]
Affects Version/s: 10.6.0.0
10.5.1.2
10.4.3.0
Triaged July 3, 2009: Downgraded to Major, ticked Repro attached and Known fix. Updated Affects versions.
User has analyzed the issue and proposed how to fix it.
> Concurrent Inserts of rows with XML data results in an exception
> ----------------------------------------------------------------
>
> Key: DERBY-3870
> URL: https://issues.apache.org/jira/browse/DERBY-3870
> Project: Derby
> Issue Type: Bug
> Components: SQL
> Affects Versions: 10.4.1.3, 10.4.3.0, 10.5.1.2, 10.6.0.0
> Environment: System: MS windows server 2003 standard edition service pack 2. Derby is run as a server on port 1527.
> Reporter: Royi Ronen
> Attachments: Copy of derby.log, DerbyMultiInsertXmlException.zip
>
>
> We insert rows into a table using the following prepared statement (through JDBC):
> INSERT INTO USER1.PSTORE values(?,?, XMLPARSE(document CAST (? AS CLOB) preserve whitespace))
> where each of the ?'s are replaced with a string.
> One thread runs fine. Two or more result in the following exception:
> org.apache.derby.client.am.SqlException: Java exception: 'FWK005 parse may not be called while parsing.: org.xml.sax.SAXException'.
> at org.apache.derby.client.am.SqlException.<init>(Unknown Source)
> at org.apache.derby.client.am.SqlException.<init>(Unknown Source)
> We believe that this comes from the dBuilder.parse(InputSource) method.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DERBY-3870) Concurrent Inserts of rows with XML
data results in an exception
Posted by "Aleksander Slominski (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-3870?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12630679#action_12630679 ]
Aleksander Slominski commented on DERBY-3870:
---------------------------------------------
BTW: the problem seems to stem from the fact that Xerces DocumentBuilder
isn't thread safe as mentioned in
http://www.oxygenxml.com/archives/xml-dev/200405/msg00149.html
and the same seems to be true about Serializer.
DocumentBuilderFactory and SerializerFactory seems to be OK
when used/shared by multiple threads.
If SqlXmlUtil was not shared between threads for exmaple
made thread private (and possibly recycled after connection is closed)
then using one DocumentBuilder instance should be fine.
However i was not able to understand life cycle of SqlXmlUtil
(sho is calling SqlXmlExecutor.getSqlXmlUtil()) and what is
elation between activations, connections and threads ...
So proper fix may be to make sure that SqlXmlUtil is safely reused
or not shared between threads ...
> Concurrent Inserts of rows with XML data results in an exception
> ----------------------------------------------------------------
>
> Key: DERBY-3870
> URL: https://issues.apache.org/jira/browse/DERBY-3870
> Project: Derby
> Issue Type: Bug
> Components: SQL
> Affects Versions: 10.4.1.3
> Environment: System: MS windows server 2003 standard edition service pack 2. Derby is run as a server on port 1527.
> Reporter: Royi Ronen
> Priority: Critical
> Attachments: Copy of derby.log, DerbyMultiInsertXmlException.zip
>
>
> We insert rows into a table using the following prepared statement (through JDBC):
> INSERT INTO USER1.PSTORE values(?,?, XMLPARSE(document CAST (? AS CLOB) preserve whitespace))
> where each of the ?'s are replaced with a string.
> One thread runs fine. Two or more result in the following exception:
> org.apache.derby.client.am.SqlException: Java exception: 'FWK005 parse may not be called while parsing.: org.xml.sax.SAXException'.
> at org.apache.derby.client.am.SqlException.<init>(Unknown Source)
> at org.apache.derby.client.am.SqlException.<init>(Unknown Source)
> We believe that this comes from the dBuilder.parse(InputSource) method.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.