fix: data race in host infrastructure proxy context map#7176
fix: data race in host infrastructure proxy context map#7176codefromthecrypt wants to merge 8 commits into
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 <adrian@tetrate.io>
Signed-off-by: Adrian Cole <adrian@tetrate.io>
Signed-off-by: Adrian Cole <adrian@tetrate.io>
|
ok sure.. will add more coverage |
c28e20b to
8bbb4f1
Compare
|
at least locally coverage is good now. 🤞 |
|
/retest |
|
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 |
|
#7362 takes this over as I wasn't able to re-open the PR |
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