Skip to content
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

Fix race condition in scheduler and quartz's ConcurrentExecutionTest #10444

Merged
merged 1 commit into from
Jul 3, 2020
Merged

Fix race condition in scheduler and quartz's ConcurrentExecutionTest #10444

merged 1 commit into from
Jul 3, 2020

Conversation

jaikiran
Copy link
Member

@jaikiran jaikiran commented Jul 3, 2020

This PR[1] ran into an unrelated failure[2] which appears to be a race condition in the ConcurrentExecutionTest. The PR here tries to prevent that race. There were 2 ConcurrentExecutionTest tests, one in quartz extension and one in scheduler. I updated them both given that they both are doing the same logic.

Having said that, there might be more going on here? The reason I say that is, this exception stacktrace of the failure:

2020-07-03T02:58:36.5610209Z [INFO] Running io.quarkus.quartz.test.ConcurrentExecutionTest
2020-07-03T02:58:37.2370796Z 2020-07-03 02:58:37,222 INFO  [io.quarkus] (main) Quarkus 999-SNAPSHOT on JVM started in 0.286s. 
2020-07-03T02:58:37.2371554Z 2020-07-03 02:58:37,230 INFO  [io.quarkus] (main) Profile test activated. 
2020-07-03T02:58:37.2372133Z 2020-07-03 02:58:37,230 INFO  [io.quarkus] (main) Installed features: [cdi, scheduler]
2020-07-03T02:58:39.2334866Z 2020-07-03 02:58:39,229 INFO  [io.quarkus] (main) Quarkus stopped in 0.003s
2020-07-03T02:58:39.2357907Z [ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 2.67 s <<< FAILURE! - in io.quarkus.quartz.test.ConcurrentExecutionTest
2020-07-03T02:58:39.2359910Z [ERROR] io.quarkus.quartz.test.ConcurrentExecutionTest.testNonconcurrentExecution  Time elapsed: 1.987 s  <<< FAILURE!
2020-07-03T02:58:39.2364006Z org.opentest4j.AssertionFailedError: expected: <1> but was: <2>
2020-07-03T02:58:39.2368414Z 	at org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:55)
2020-07-03T02:58:39.2373236Z 	at org.junit.jupiter.api.AssertionUtils.failNotEqual(AssertionUtils.java:62)
2020-07-03T02:58:39.2377864Z 	at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:150)
2020-07-03T02:58:39.2382881Z 	at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:145)
2020-07-03T02:58:39.2387302Z 	at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:510)
2020-07-03T02:58:39.2394124Z 	at io.quarkus.quartz.test.ConcurrentExecutionTest.testNonconcurrentExecution(ConcurrentExecutionTest.java:29)

Notice that it says io.quarkus.quartz.test.ConcurrentExecutionTest.testNonconcurrentExecution Time elapsed: 1.987 s. I can't see how that test can take anything less than 2.x seconds (given the LATCH and the schedule on the concurrent() method). Perhaps the JUnit5 reporting is at fault or maybe there indeed is some other issue going on?

[1] #10442
[2] https://github.com/quarkusio/quarkus/pull/10442/checks?check_run_id=832968580

@mkouba
Copy link
Contributor

mkouba commented Jul 3, 2020

Hi @jaikiran and thanks for spotting this. The test is indeed unreliable. Unfortunately, I did not see a better way to implement a proper test. I'll investigate this today and we should probably ignore these tests for now.

Copy link
Member

@machi1990 machi1990 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@geoand geoand merged commit 71e2452 into quarkusio:master Jul 3, 2020
@mkouba
Copy link
Contributor

mkouba commented Jul 3, 2020

@geoand You're too fast. I didn't even manage to look at the changes ;-). Anyway, here's the PR to disable the tests: #10445

@geoand
Copy link
Contributor

geoand commented Jul 3, 2020

Oh shoot! I saw your comment and I thought you had approved. My bad!

@mkouba
Copy link
Contributor

mkouba commented Jul 3, 2020

No problem at all! :-)

@jaikiran jaikiran deleted the scheduler-test-race branch July 4, 2020 14:25
@gsmet gsmet added this to the 1.7.0 - master milestone Jul 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants