Skip to content

SettableListenableFuture setException is inconsistent with callbacks under race [SPR-15409] #19972

Closed
@spring-projects-issues

Description

@spring-projects-issues

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:

Referenced from: commits 8321f01, 8cb24e0

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions