Conversation
…route finishes CamelServlet.doServiceAsync() (async=true without executorRef) completed the AsyncContext right after doService() returned, discarding the CompletionStage that doExecute() returns when the route continues on another thread. This races the container's async completion against the later writeResponse(), giving an IllegalStateException on the recycled response (Tomcat) or an empty/stale response. camel-jetty in async mode (async=true&useContinuation=false) hits the same path via super.doService(). doService() keeps its void signature (protected extension point, must stay binary compatible for backports); the in-flight stage is handed over via the CamelAsyncPromise request attribute and doServiceAsync() completes the AsyncContext only once it is done, mirroring doAsyncExecution(). Also: complete the AsyncContext in doAsyncExecution()'s error branch (onError always throws), and always write the response / finish the UoW when processAsync() fails synchronously or completes exceptionally. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #26584 to
camel-4.14.x(straight cherry-pick, no conflicts).Fixes CAMEL-24811:
CamelServlet.doServiceAsync()(async=true without executorRef, and camel-jetty withasync=true&useContinuation=false) completed theAsyncContextbefore a route that resumes on another thread had written its response. The bug dates from CAMEL-11731 (Camel 3.7), so every LTS branch is affected.No API changes:
doService()keeps its signature, the in-flight stage is handed over via aprotectedrequest attribute constant. No upgrade guide entry needed.Draft until #26584 is reviewed and merged on
main.Claude Code on behalf of Croway