-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Parallel execution is not working properly making one thread to wait for another to finish the action #2222
Comments
@Shcherbakoval this is good catch and thanks for this. but first let me correct you - the blocking only happens for JS code and not the other workloads (Java, normal HTTP calls). as proof try to run this test: Feature: test sample feature
Scenario: test1
* karate.log("Test 1 About to sleep for 2 seconds")
* java.lang.Thread.sleep(2000)
* karate.log("Test 1 Woke up")
Scenario: test2
* karate.log("Test 2 About to sleep for 2 seconds")
* java.lang.Thread.sleep(2000)
* karate.log("Test 2 Woke up") and you can look at the timeline report for confirmation: So yes, we have this limitation that any JS code executed will perform a global lock. we don't like it - but there is a big history for this, refer: #2081 in my experience, and from what we hear from enterprise users, this is not an issue for normal tests as long as you ensure that any JS you use is only for utilities and business logic. if you use @Shcherbakoval you are most welcome to contribute thoughts, ideas and ideally code to improve this ;) I will leave this open for a while for discussion, else close this as |
closing because of no response |
and #2222 could be a consequence of that so we are making sure that any js functions in a callSingle result are re-hydrated to current context
reopening as there is one more report of this: https://stackoverflow.com/q/75371624/143475 considering high priority. please try to build from source until we release 1.4.0.RC4: https://github.com/karatelabs/karate/wiki/Developer-Guide |
failing test was ParallelOutlineTest.testParallelOutline
1.4.0 released |
Description:
It looks like the parallel execution of Scenarios behaves more like a blocking queue, making one thread to wait for another to finish the action it doing at the moment. The action could anything like executing JS, Java code or making an HTTP call.
Steps to reproduce:
In the attached zip run the
ExampleTest.java
which is set to run a single Feature file containing 2 Scenarios both doing the same thing:Actual result:
Both Scenarios are executed, one of them actually was sleeping for 2 seconds, another one however been sleeping for 4 seconds, thus waiting for the first Scenario to sleep and then start sleeping itself.
Expected result:
Both Scenarios should've slept for 2 seconds and not block each others execution. Producing the output like this, where difference between calls is actually 2 seconds
karateTest.zip
You can run this either from your favourite IDE or simply using
mvn clean test
.The text was updated successfully, but these errors were encountered: