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 mutex unlocking in monitoring registry #30638

Merged
merged 1 commit into from
Mar 2, 2022

Conversation

kvch
Copy link
Contributor

@kvch kvch commented Mar 2, 2022

What does this PR do?

This PR adds missing defer keywords so mutexes only after the real critical section.

The problem was reported by golangci linter we use in https://github.com/elastic/elastic-agent-libs.

Why is it important?

Previously in the monitoring registry implementation two mutexes were unlocked right after locking. So the data structures they were supposed to protect were still subject to concurrent access.

Checklist

  • My code follows the style guidelines of this project
    - [ ] I have commented my code, particularly in hard-to-understand areas
    - [ ] I have made corresponding changes to the documentation
    - [ ] I have made corresponding change to the default configuration files
    - [ ] I have added tests that prove my fix is effective or that my feature works
    - [ ] I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Mar 2, 2022
@kvch kvch added the Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team label Mar 2, 2022
@elasticmachine
Copy link
Collaborator

Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Mar 2, 2022
@mergify mergify bot assigned kvch Mar 2, 2022
@mergify
Copy link
Contributor

mergify bot commented Mar 2, 2022

This pull request does not have a backport label. Could you fix it @kvch? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v./d./d./d is the label to automatically backport to the 7./d branch. /d is the digit

NOTE: backport-skip has been added to this pull request.

@mergify mergify bot added the backport-skip Skip notification from the automated backport with mergify label Mar 2, 2022
@kvch kvch added backport-7.17 Automated backport to the 7.17 branch with mergify backport-v8.0.0 Automated backport with mergify backport-v8.1.0 Automated backport with mergify bug and removed backport-skip Skip notification from the automated backport with mergify labels Mar 2, 2022
@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2022-03-02T10:30:44.220+0000

  • Duration: 139 min 32 sec

Test stats 🧪

Test Results
Failed 0
Passed 42995
Skipped 3846
Total 46841

💚 Flaky test report

Tests succeeded.

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@jlind23 jlind23 requested a review from a team March 2, 2022 14:36
@kvch kvch merged commit 4fabfb1 into elastic:main Mar 2, 2022
mergify bot pushed a commit that referenced this pull request Mar 2, 2022
mergify bot pushed a commit that referenced this pull request Mar 2, 2022
mergify bot pushed a commit that referenced this pull request Mar 2, 2022
kvch added a commit that referenced this pull request Mar 3, 2022
(cherry picked from commit 4fabfb1)

Co-authored-by: Noémi Ványi <kvch@users.noreply.github.com>
kvch added a commit that referenced this pull request Mar 3, 2022
(cherry picked from commit 4fabfb1)

Co-authored-by: Noémi Ványi <kvch@users.noreply.github.com>
kvch added a commit that referenced this pull request Mar 3, 2022
(cherry picked from commit 4fabfb1)

Co-authored-by: Noémi Ványi <kvch@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-7.17 Automated backport to the 7.17 branch with mergify backport-v8.0.0 Automated backport with mergify backport-v8.1.0 Automated backport with mergify bug Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants