[ https://issues.apache.org/jira/browse/XERCESJ-1687?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16324043#comment-16324043 ]
Mukul Gandhi commented on XERCESJ-1687: --------------------------------------- @Stephan: I've done some more analysis of this bug. Here are my new findings. The definitions of these JAXP classes say, SchemaFactory : is not thread-safe Validator : is not thread-safe Schema : is thread safe I saw your unit test code again. Your usage of SchemaFactory is shared with all the threads (therefore it violates the above definition). Therefore, I moved the line getResourceAsSchema(..) inside the thread's run() method (for your parallel test case. but then this also creates a new Schema object for each thread). After this change, when I have 50 parallel threads (as specified in your test case), sometimes all validations pass, and sometimes I get 1 or 4 failures. But its not worse than this finding. Of course, your test case testSingleThread() always passes. Here's an interesting article, https://www.ibm.com/developerworks/library/x-javaxmlvalidapi/index.html, that says: "You can reuse the same validator and the same schema multiple times in series. However, only the schema is thread safe. Validators and schema factories are not. If you validate in multiple threads simultaneously, make sure each one has its own Validator and SchemaFactory objects." > XSD 1.1 validation with xs:assert is not thread safe > ---------------------------------------------------- > > Key: XERCESJ-1687 > URL: https://issues.apache.org/jira/browse/XERCESJ-1687 > Project: Xerces2-J > Issue Type: Bug > Components: JAXP (javax.xml.validation) > Environment: java 8 / java 9 > Reporter: Stephan Trebels > Priority: Critical > Attachments: parallel-test.zip > > > The XSD 1.1 validation code uses eclipse webtools xpath to validate > assertions. The PsychoPath XPath 2.0 engine has a bug in > ResultSequenceFactory, which invalidates correct execution in all parallel > invocation of XSD 1.1 validation. > This issue affects completely unrelated schemas and input XML, as long as > both use assertions. The effect is a lot of spurious assert violations. The > issue is visible even if only two threads are used in parallel. > https://bugs.eclipse.org/bugs/show_bug.cgi?id=527812 -- This message was sent by Atlassian JIRA (v6.4.14#64029) --------------------------------------------------------------------- To unsubscribe, e-mail: j-dev-unsubscr...@xerces.apache.org For additional commands, e-mail: j-dev-h...@xerces.apache.org