Skip to content

Fix HttpClient 5.x callback span handling - #832

Open
Ayush0612005 wants to merge 1 commit into
apache:mainfrom
Ayush0612005:fix/httpclient5-future-callback-span
Open

Ayush0612005 wants to merge 1 commit into
apache:mainfrom
Ayush0612005:fix/httpclient5-future-callback-span

Conversation

@Ayush0612005

Copy link
Copy Markdown

Fix HttpClient 5.x plugin closing the caller thread's active span (#14097)

  • Add a unit test to verify that the fix works.
  • Explain briefly why the bug exists and how to fix it.

The HttpClient 5.x plugin's FutureCallbackWrapper previously stopped the
currently active span without checking whether that span belonged to the
HttpClient request.

When the FutureCallback executes on the caller/business thread, this can
incorrectly stop the caller's active span.

The fix tracks the request-owned local span in the HttpContext and only
stops it when it is the active span on the current thread. The local span is
also explicitly finished on the I/O thread after the response is consumed.
Regression tests cover callbacks executing on both I/O and caller/business
threads.

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.

1 participant