Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.4.0, 1.5.0
Description
Test ResourceGuard#testCloseBlockIfAcquired() fails sporadically with
java.io.IOException: Resource guard was already closed. at org.apache.flink.util.ResourceGuard.acquireResource(ResourceGuard.java:72) at org.apache.flink.util.ResourceGuardTest.testCloseBlockIfAcquired(ResourceGuardTest.java:74) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55) at org.junit.rules.RunRules.evaluate(RunRules.java:20)
How to reproduce
Run the test with a high number of iterations.
To further provoke a failure, add Thread.sleep(100) before the following line
ResourceGuard.Lease lease_2 = resourceGuard.acquireResource();
This will more likely result in closed being true at the time the 2nd lease is acquired and an exception is thrown:
if (closed) { throw new IOException("Resource guard was already closed."); }
Attachments
Issue Links
- links to