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

TestEvictableCache.testLoadFailure is flaky #19882

Closed
losipiuk opened this issue Nov 23, 2023 · 4 comments · Fixed by #19905
Closed

TestEvictableCache.testLoadFailure is flaky #19882

losipiuk opened this issue Nov 23, 2023 · 4 comments · Fixed by #19905
Assignees
Labels
bug Something isn't working test

Comments

@losipiuk
Copy link
Member

Error:  io.trino.cache.TestEvictableCache.testLoadFailure -- Time elapsed: 0.035 s <<< FAILURE!
org.opentest4j.AssertionFailedError: 

Expecting actual:
  ["com.google.common.util.concurrent.UncheckedExecutionException: java.lang.RuntimeException: first attempt is poised to fail",
    "success"]
to contain exactly (and in same order):
  ["com.google.common.util.concurrent.UncheckedExecutionException: java.lang.RuntimeException: first attempt is poised to fail",
    "com.google.common.util.concurrent.UncheckedExecutionException: java.lang.RuntimeException: first attempt is poised to fail"]
but some elements were not found:
  ["com.google.common.util.concurrent.UncheckedExecutionException: java.lang.RuntimeException: first attempt is poised to fail"]
and others were not expected:
  ["success"]

	at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62)
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502)
	at io.trino.cache.TestEvictableCache.testLoadFailure(TestEvictableCache.java:333)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1583)

[INFO] Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.468 s -- in io.trino.cache.TestEvictableLoadingCache
[INFO] 
[INFO] Results:
[INFO] 
Error:  Failures: 
Error:  io.trino.cache.TestEvictableCache.testLoadFailure
[INFO]   Run 1: PASS
[INFO]   Run 2: PASS
[INFO]   Run 3: PASS
[INFO]   Run 4: PASS
Error:    Run 5: TestEvictableCache.testLoadFailure:333 
Expecting actual:
  ["com.google.common.util.concurrent.UncheckedExecutionException: java.lang.RuntimeException: first attempt is poised to fail",
    "success"]
to contain exactly (and in same order):
  ["com.google.common.util.concurrent.UncheckedExecutionException: java.lang.RuntimeException: first attempt is poised to fail",
    "com.google.common.util.concurrent.UncheckedExecutionException: java.lang.RuntimeException: first attempt is poised to fail"]
but some elements were not found:
  ["com.google.common.util.concurrent.UncheckedExecutionException: java.lang.RuntimeException: first attempt is poised to fail"]
and others were not expected:
  ["success"]

[INFO]   Run 6: PASS
[INFO]   Run 7: PASS
[INFO]   Run 8: PASS
[INFO]   Run 9: PASS
[INFO]   Run 10: PASS
[INFO] 
@losipiuk losipiuk added the test label Nov 23, 2023
@losipiuk
Copy link
Member Author

cc: @findepi

@findepi
Copy link
Member

findepi commented Nov 24, 2023

How can the test be flaky if it doesn't run on CI?
#19894

@findepi findepi added the bug Something isn't working label Nov 27, 2023
@findepi
Copy link
Member

findepi commented Nov 27, 2023

Don't know/remember what the code author had in mind, but this looks suspicious

Thread.sleep(1); // increase chances that second thread calls cache.get before we return

commenting the sleep out makes the test very flaky (~50%) locally, so it looks the test relies on sleep(1) for synchronization

@findepi
Copy link
Member

findepi commented Nov 27, 2023

This should solve the problem: #19905

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working test
Development

Successfully merging a pull request may close this issue.

2 participants