Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix session lock of OtlpHttpClient #1760

Merged
merged 5 commits into from
Nov 22, 2022
Merged

Conversation

owent
Copy link
Member

@owent owent commented Nov 10, 2022

Signed-off-by: owent [email protected]

Fixes #1759

Changes

  • Fix session lock of OtlpHttpClient

For significant contributions please make sure you have completed the following items:

  • CHANGELOG.md updated for non-trivial changes
  • Unit tests have been added
  • Changes in public API reviewed

@owent owent requested a review from a team November 10, 2022 04:01
@codecov
Copy link

codecov bot commented Nov 10, 2022

Codecov Report

Merging #1760 (cff77ec) into main (8f778b7) will increase coverage by 0.02%.
The diff coverage is n/a.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1760      +/-   ##
==========================================
+ Coverage   85.77%   85.79%   +0.02%     
==========================================
  Files         171      171              
  Lines        5220     5220              
==========================================
+ Hits         4477     4478       +1     
+ Misses        743      742       -1     
Impacted Files Coverage Δ
sdk/src/trace/batch_span_processor.cc 91.41% <0.00%> (+0.79%) ⬆️

@owent
Copy link
Member Author

owent commented Nov 10, 2022

The failed job seems not a problem of this PR.

session_data.event_handle;
{
std::lock_guard<std::recursive_mutex> guard{session_manager_lock_};
static_cast<ResponseHandler *>(handle.get())->Bind(this, *session);
Copy link
Member

Choose a reason for hiding this comment

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

Does this statement needs to be under lock ?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, it's not necessary, but I think ResponseHandler::Bind and inserting element into running_sessions_ below should work together logically.


HttpSessionData &store_session_data = running_sessions_[key];
store_session_data = std::move(session_data);
HttpSessionData &store_session_data = running_sessions_[session.get()];
Copy link
Member

Choose a reason for hiding this comment

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

Just curious , why can't we just use session_data.session.get() instead of session.get() for indexing here?

Copy link
Member Author

@owent owent Nov 11, 2022

Choose a reason for hiding this comment

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

I believe it's same here.

Copy link
Member

@lalitb lalitb left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for the fix.

@lalitb lalitb merged commit 6644ddd into open-telemetry:main Nov 22, 2022
@owent owent deleted the fix_1759 branch November 28, 2022 11:49
yxue pushed a commit to yxue/opentelemetry-cpp that referenced this pull request Dec 5, 2022
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.

May crash when using OTLP Http exporter in async mode
3 participants