Description
Ivan Sopov opened SPR-15409 and commented
In continuation of #19781 and #19766 I decided to test setException method of SettableListenableFuture and received another portion of strange results.
With methods set(value) and setException(new Exception()) executed under race following cases are possible:
- Both methods return false but SuccessCallback is executed
- Both methods return false but FailureCallback is executed
I consider these cases as two flavors of the same problem - actually I expect that one of two methods will always return true.
Jcstress-based tests may be found here:
https://github.com/isopov/isopov-jcstress/blob/master/src/main/java/com/sopovs/moradanen/jcstress/spring/SettableListenableFuture3Test.java
Also I tried to reproduce the problem without jcstress to better understand it and make sure that it lies not in my poor understanding of jcstress:
https://github.com/isopov/isopov-jcstress/blob/master/src/main/java/com/sopovs/moradanen/jcstress/spring/SettableListenableFutureMain3Test.java
This test does not reproduce the problem as reliably as jcstress-based one, but sometimes it still reproduces both flavors of the problem in the single run.
Affects: 4.3.7
Issue Links:
- SettableListenableFuture may be both set and canceled successfully [SPR-15202] #19766 SettableListenableFuture may be both set and canceled successfully
- SettableListenableFuture may be successfully set with failureCallback executed and success callback ignored [SPR-15216] #19781 SettableListenableFuture may be successfully set with failureCallback executed and success callback ignored