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: child span not acquiring transaction lock in some cases #1487

Merged
merged 14 commits into from
Jul 26, 2023

Conversation

kruskall
Copy link
Member

Spans from the same transaction share the dropped spans map. If they end concurrency a race condition could happen when updating the map.
Add a RW lock to prevent that.

Closes #1484

Spans from the same transaction share the dropped spans map.
If they end concurrency a race condition could happen when updating
the map.
Add a RW lock to prevent that.
@kruskall kruskall requested a review from a team July 11, 2023 14:02
Copy link
Contributor

@marclop marclop left a comment

Choose a reason for hiding this comment

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

Would you mind adding a test covering the bug?

@kruskall kruskall changed the title fix: acquire lock before adding dropped spans fix: child span not acquiring transaction lock in some cases Jul 11, 2023
@kruskall
Copy link
Member Author

I've added a test and discovered more issues. It seems this is affecting more than just the dropped spans.

I've pushed some changes and added a test.

@kruskall kruskall requested review from dmathieu and marclop July 11, 2023 15:59
Copy link
Contributor

@marclop marclop left a comment

Choose a reason for hiding this comment

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

Thanks, this looks better!

span.go Show resolved Hide resolved
span_test.go Outdated Show resolved Hide resolved
span_test.go Show resolved Hide resolved
Copy link
Contributor

@simitt simitt left a comment

Choose a reason for hiding this comment

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

Once this is ready to merge, please also add a changelog entry

@kruskall
Copy link
Member Author

Once this is ready to merge, please also add a changelog entry

Where should I add that ? Looking at past releases, we're adding all the changelog entries on release

@kruskall kruskall requested a review from simitt July 13, 2023 15:54
@kruskall
Copy link
Member Author

@simitt could you clarify the above question ?

@axw
Copy link
Member

axw commented Jul 26, 2023

@kruskall in the past we have added entries to the Unreleased section. We've not been consistent about it though, and have sometimes just added the entries retrospectively at release time. Let's merge this and create a patch release - either adding the entry now, or creating the section at release time.

@simitt
Copy link
Contributor

simitt commented Jul 26, 2023

Apologies @kruskall , I missed your message.

@kruskall kruskall requested a review from a team as a code owner July 26, 2023 07:32
@kruskall kruskall enabled auto-merge (squash) July 26, 2023 07:32
kruskall and others added 11 commits July 26, 2023 11:26
The previous fix didn't cover all cases. The issue is deeper and affects more than the
transaction data. We need to always acquire the tx lock before ending the span.
Co-authored-by: Marc Lopez Rubio <marc5.12@outlook.com>
Co-authored-by: Marc Lopez Rubio <marc5.12@outlook.com>
Co-authored-by: Marc Lopez Rubio <marc5.12@outlook.com>
* docs: update doc with go support policy

* docs: remove go.mod comment

the doc doesn't actually mention specific versions
…astic#1496)

* docs: mention public bug bounty program in security policy

* docs: remove SECURITY.md to fallback to org-wide security policy
@kruskall kruskall force-pushed the fix/dropped-span-race branch from bd9e836 to 863c772 Compare July 26, 2023 09:26
@kruskall kruskall merged commit 1c14a96 into elastic:main Jul 26, 2023
@kruskall kruskall deleted the fix/dropped-span-race branch August 31, 2023 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fatal error: concurrent map writes
6 participants