You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When validating XML files in separate threads, the value of this variable is sometimes changed during the validation of an XML file.
This is visible in the SVRL, which shows that rules for other values are fired (simplified example):
This only happens when the application is under load (in production...): concurrent requests to validate different XML that have different values for the variable.
Here's what I think is happening:
1/ During the bind part, a single instance of XPathLetVariableResolver is created, and kept in the PSXPathBoundSchema object
2/ ThreadA starts validating an XML: variables are evaluated and their value stored in XPathLetVariableResolver, and some rules are executed
3/ ThreadB starts validating another XML: variables are evaluated and their value stored in the same XPathLetVariableResolver, overwriting the values set by ThreadA
4/ ThreadA executes rules that reference variables, so uses the values set by ThreadB.
My first idea is to make the map that stores variable values ThreadLocal.
But I guess that first we need a way to reproduce the problem reliably...
Any help or suggestions are welcome !
The text was updated successfully, but these errors were encountered:
This test currently fails because the value of the "var" variable" set
by one thread is overwritten by the other thread.
Theoretically this test would fail or not depending on how the 2 threads
are executed and interweaved. But it seems to always fail, so no further
complication is added for now.
To ensure that variable values are not overwritten when different XML
are validated on separate threads, store the variable values in aborts
ThreadLocal map.
Fixes issue phax#182.
In the Schematron rules we use, a variable is defined at the top level and stores a value for the XML being validated:
It is then used in lots of rule contexts:
When validating XML files in separate threads, the value of this variable is sometimes changed during the validation of an XML file.
This is visible in the SVRL, which shows that rules for other values are fired (simplified example):
This only happens when the application is under load (in production...): concurrent requests to validate different XML that have different values for the variable.
Here's what I think is happening:
1/ During the bind part, a single instance of
XPathLetVariableResolver
is created, and kept in thePSXPathBoundSchema
object2/ ThreadA starts validating an XML: variables are evaluated and their value stored in
XPathLetVariableResolver
, and some rules are executed3/ ThreadB starts validating another XML: variables are evaluated and their value stored in the same
XPathLetVariableResolver
, overwriting the values set by ThreadA4/ ThreadA executes rules that reference variables, so uses the values set by ThreadB.
My first idea is to make the map that stores variable values ThreadLocal.
But I guess that first we need a way to reproduce the problem reliably...
Any help or suggestions are welcome !
The text was updated successfully, but these errors were encountered: