[ 
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.

Reply via email to