Skip to content

[#4035] fix invocation context loss issue#4057

Closed
yanghao605 wants to merge 1 commit intoapache:masterfrom
yanghao605:master_context
Closed

[#4035] fix invocation context loss issue#4057
yanghao605 wants to merge 1 commit intoapache:masterfrom
yanghao605:master_context

Conversation

@yanghao605
Copy link
Copy Markdown
Contributor

Follow this checklist to help us incorporate your contribution quickly and easily:

  • Make sure there is a JIRA issue filed for the change (usually before you start working on it). Trivial changes like typos do not require a JIRA issue. Your pull request should address just this issue, without pulling in other changes.
  • Each commit in the pull request should have a meaningful subject line and body.
  • Format the pull request title like [SCB-XXX] Fixes bug in ApproximateQuantiles, where you replace SCB-XXX with the appropriate JIRA issue.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Run mvn clean install -Pit to make sure basic checks pass. A more thorough check will be performed on your pull request automatically.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

Comment on lines +53 to 55
public synchronized Span createSpan(Invocation invocation) {
return handler.handleSend(requestWrapper.invocation(invocation));
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This fix seems not correct. HttpClientResponseWrapper/HttpClientRequestWrapper should be invocation scope, not bean scope. Synchronization can not fix this problem .

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Based on my understanding of the brave's source code, I think only this part can set context to invocation.
image
When the handler. handleSend() method is called, it will insert the context related to trace into the invocation.
image
image

And after I added synchronized and tested again, there was no further loss of context

Copy link
Copy Markdown
Contributor

@liubao68 liubao68 Nov 28, 2023

Choose a reason for hiding this comment

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

Synchronization maybe very pool performance. Event your notice is correct, the modification is not good.

And maybe create a new wrapper instance is faster than synchronization.

@liubao68 liubao68 closed this Dec 4, 2023
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.

2 participants