-
Couldn't load subscription status.
- Fork 579
fix: data race in host infrastructure proxy context map #7176
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: data race in host infrastructure proxy context map #7176
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7176 +/- ##
==========================================
+ Coverage 71.10% 71.12% +0.01%
==========================================
Files 228 228
Lines 40678 40686 +8
==========================================
+ Hits 28926 28937 +11
+ Misses 10059 10054 -5
- Partials 1693 1695 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ef4c378 to
415abb5
Compare
dab5d78 to
c73790d
Compare
|
Code LGTM and if you fix the linting/import issues I'll approve |
|
weird no idea why this closed.. sorry about that. |
0678aae to
02aeb1a
Compare
|
@codefromthecrypt thanks for adding this. Could you please add more test coverage to make the bots happy? |
This commit fixes a data race in the host infrastructure where proxyContextMap was being accessed concurrently without synchronization. The race occurred between: - runEnvoy() writing to the map (line 92) - Close() reading from the map (line 37) - stopEnvoy() reading and deleting from the map (lines 125, 129) Added a sync.RWMutex to protect all accesses to proxyContextMap: - Use RLock for reads in Close() and CreateOrUpdateProxyInfra() - Use Lock for writes in runEnvoy() and stopEnvoy() - Extract map keys before iteration in Close() to avoid holding the lock while calling stopEnvoy() This ensures thread-safe access to the proxy context map during concurrent infrastructure operations. Signed-off-by: Adrian Cole <[email protected]>
Signed-off-by: Adrian Cole <[email protected]>
Signed-off-by: Adrian Cole <[email protected]>
Signed-off-by: Adrian Cole <[email protected]>
Signed-off-by: Adrian Cole <[email protected]>
Signed-off-by: Adrian Cole <[email protected]>
Signed-off-by: Adrian Cole <[email protected]>
|
ok sure.. will add more coverage |
Signed-off-by: Adrian Cole <[email protected]>
c28e20b to
8bbb4f1
Compare
|
at least locally coverage is good now. 🤞 |
|
/retest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thanks
|
Looks like the new tests are failing @codefromthecrypt |
|
I'll close this and re-open it after #7225 is merged because the /tmp tech debt is haunting |
What this PR does / why we need it:
This commit fixes a data race in the host infrastructure where proxyContextMap was being accessed concurrently without synchronization.
The race occurred between:
Which issue(s) this PR fixes:
Race found in envoyproxy/ai-gateway#1314