Skip to content

Completes async client futures when the delegate throws Error - #3630

Merged
velo merged 3 commits into
OpenFeign:masterfrom
hutiefang76:frank/thirty-feign-async-error-20261019
Nov 9, 2026
Merged

velo merged 3 commits into
OpenFeign:masterfrom
hutiefang76:frank/thirty-feign-async-error-20261019

Conversation

@hutiefang76

Copy link
Copy Markdown
Contributor

Fixes #3629.

When a synchronous Client throws an Error, DefaultAsyncClient currently lets the executor capture it in a task future that is only used for cancellation. The separate future returned to the caller remains pending, including through AsyncFeign. Complete that future exceptionally with the original throwable. Executor rejection, cancellation, checked/runtime exceptions and the other async adapters retain their existing behavior.

Two bounded regressions cover the direct adapter and public proxy, with the same error instance asserted as the cause. IOException, runtime-exception and successful-response controls are included in the existing test class. The changelog records the fix; no API or dependency changes.

Validation:

  • Original source plus regressions: AsyncFeignTest 59 tests, 2 failures from the expected one-second timeouts; 0 errors/skips.
  • Fixed source: full core mvn -B -Pdev -pl core clean install passes, 777 tests, 0 failures/errors, 4 existing conditional skips. All 59 async tests pass without skips.
  • Root mvn -B -Pdev validate passes. Main sources used a real JDK 8 toolchain and tests used JDK 25. A normal checkout was used because the license plugin fails to recognize Git worktrees; license and formatting checks were retained, and the three final files were matched by SHA-256.

AI assistance: DeepSeek assisted implementation and first-pass review; Codex ran and checked the reproduction, validation and final diff. Remote CI and maintainer review remain pending.

@velo velo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked DefaultAsyncClient: the task goes through executorService.submit, so an Error was already captured in the discarded FutureTask and never rethrown anywhere; completing the caller's future with it surfaces the Error instead of swallowing it, which is the right channel. Both regressions time out without the change. Nits: the three control tests are mostly redundant with existing coverage, and the inline comment in DefaultAsyncClient could go since the catch speaks for itself.

@velo
velo enabled auto-merge (squash) November 9, 2026 20:39
@velo

velo commented Nov 9, 2026

Copy link
Copy Markdown
Member

Approved, but this now conflicts with master in CHANGELOG.md (a 13.18 section was added by another merge). Could you merge or rebase master and append your entry under the existing ### Version 13.18 heading? Auto-merge is enabled, so it will land once checks pass.

velo added 2 commits November 9, 2026 17:56
Signed-off-by: Marvin Froeder <velo.br@gmail.com>

# Conflicts:
#	CHANGELOG.md
Signed-off-by: Marvin Froeder <velo.br@gmail.com>
@velo

velo commented Nov 9, 2026

Copy link
Copy Markdown
Member

Merged master; CHANGELOG.md was removed from the repo so the entry was dropped. Also removed the redundant inline comment from the review nit.

@velo
velo merged commit 3a39300 into OpenFeign:master Nov 9, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DefaultAsyncClient never completes the returned future when Client throws Error

2 participants