Skip to content

ListenableFutureAdapter.addCallback may or may not propagate failures from a FailureCallback in the calling thread [SPR-13785] #18358

@spring-projects-issues

Description

@spring-projects-issues

Scott Feldstein opened SPR-13785 and commented

There is a problem in AsyncRestTemplate where it does not consistently propagate an exception up the stack from the error callback.

I am attaching code to reproduce the issue.

Import the spring starter project into STS and then run the AsyncrestremplatebugApplicationTests.

The test method bug() will fail while the test method works() will pass. The only difference btwn the methods is that there is a sleep in the works() method. The sleep allows the rest call time to fail so the subsequent call to future.get() will immediately call the error callback.

In the bug() method the rest call does not complete before the error callback is added and therefore it fails. I used Thread.sleep() in my Controller to ensure that the callbacks are added before the rest call is completed.

I would expect the same the exception from the failure callback would be consistently thrown.


Affects: 4.1.6, 4.2.3

Attachments:

Issue Links:

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions