Skip to content

Fixes race condition on provider/runner#5538

Merged
arkodg merged 1 commit intoenvoyproxy:mainfrom
mathetake:raceinerror
Mar 18, 2025
Merged

Fixes race condition on provider/runner#5538
arkodg merged 1 commit intoenvoyproxy:mainfrom
mathetake:raceinerror

Conversation

@mathetake
Copy link
Copy Markdown
Member

What type of PR is this?
fix: race condition

What this PR does / why we need it:

There's a race condition in provider/runner.Start where it writes values into err variable from multiple goroutines.

Which issue(s) this PR fixes:

Fixes #5505

Release Notes: No

Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
@mathetake mathetake marked this pull request as ready for review March 18, 2025 15:52
@mathetake mathetake requested a review from a team as a code owner March 18, 2025 15:53
r.Logger.Info("Running provider", "type", p.Type())
go func() {
if err = p.Start(ctx); err != nil {
if err := p.Start(ctx); err != nil {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

err is a return value from the outer Start so this is a race without shadowing

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 18, 2025

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 65.19%. Comparing base (aba2658) to head (b30d118).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
internal/provider/runner/runner.go 0.00% 1 Missing ⚠️

❌ Your patch status has failed because the patch coverage (0.00%) is below the target coverage (60.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5538      +/-   ##
==========================================
- Coverage   65.23%   65.19%   -0.04%     
==========================================
  Files         213      213              
  Lines       34042    34042              
==========================================
- Hits        22206    22193      -13     
- Misses      10510    10520      +10     
- Partials     1326     1329       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

@arkodg arkodg 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 !

@arkodg arkodg requested review from a team March 18, 2025 17:36
@arkodg arkodg merged commit 4143f5c into envoyproxy:main Mar 18, 2025
24 of 25 checks passed
@mathetake mathetake deleted the raceinerror branch March 18, 2025 18:50
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.

race condition between watcheabler.Map.Close and Subscribe

3 participants