-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Java type in karate-config with parallel runner causing error: Multi threaded access #1558
Comments
Think I can probably do a workaround by defining a javascript object and then defining individual functions on that javascript object to simulate static method interop, only doing Java.type inside the function call |
thanks, this helps cc @joelpramos |
@ericdriggs so - this is a won't fix. I've added this below to the documentation. given the way graal js behaves today there is no way we can get a java instance created on one thread to work across threads. anybody is welcome to find a way. I've tweaked our existing parallel troublemaker test to replicate this if you comment out one line in the offending karate-config.js. |
@ptrthomas far from me to say this solves everything (cause you know, Graal) but either of lines added in the I think it's worth adding |
@joelpramos that's a neat trick and I'm still not sure how it works, and glad I had the tests lined up. do review ! |
…th callSingle() in karate-config.js
@ptrthomas ericdriggs/karate-parallel-runner-concurrent-access@81003b0
|
not planning to look at this immediately. any help welcome |
work in progress and greatly improved error logging for config js failures
@joelpramos the second point ( the rest - you are welcome to prove there is a significant impact (I think not, all the processing is in-memory, and based on the build run-time) and make changes. this has not been easy to work on |
Like you I'm not too fussed about it. The one on the Hopefully the battle is over. |
this time simlifying the detach routine to be less prone to graal issues not able to avoid the synchronize for recurseAndAttach() had to add a coupld more but thankfully only for the callonce / callsingle flows but still saw a failure once in a while
@joelpramos tried to remove the sync on tried a few more things as you can see in the prev commit a tip: running this can replicate the problem easily on local
|
no more locking at all except for the callonce / callSingle flows if any troublesome value is encountered we throw it out with a log message and the name of the variable if tests depend on functions from callonce / callSingle or java classes / code they may fail but thats the fault of the user - the log messages should guide you what to stop doing and if you switch on TRACE logging you will see more detailed stack traces for diagnosis
Thanks for your continued work on this. |
indeed! @ptrthomas I added a few comments in the commits but it's mostly to wrap my head around the changes you are doing so that when I have some time to fetch the code and iterate on this I'm not totally lost |
just released 1.1.0.RC4 - I request everyone to re-test this once cc @aleruz |
Pass - Validated on RC4 for MVC project and my own projects. |
which is to pass java functions around as Function instances not JS snippets which means they become graal host objects - which do not have the multi-threading issues added some docs to make this clear etc
all please see this comment on the other related issue. it is possible to use java functions (not just classes) safely and work around some of the graal limitations: #1633 (comment) |
@ptrthomas |
@ericdriggs reco is only if you a) use java functions ("use" means you actually call the function in parallel scenarios) I also feel the extra code is only in the Java side. the JS side is the same one or two lines |
Given using config = karate.callSingle to define a Java.type variable
When execute parallel runner,
Then get reliable "Multi threaded access requested by thread" error
MVC repo (tests pass when run individually, failure when run in parallel):
https://github.com/ericdriggs/karate-parallel-runner-concurrent-access/
Seems related to oracle/graal#631
The text was updated successfully, but these errors were encountered: