Repository navigation
test: Wait for cert_active before interrupting the on_demand handshake - #48967
Merged
RyanTheOptimist merged 1 commit intoNov 5, 2026
Merged
Conversation
ClientInterruptedHandshake asserted cert_active == 1 straight after waitCertsRequested(1). The secret manager increments cert_requested and then cert_active on the main thread, so the test thread can see the counter at 1, close the client and read the gauge before the second increment lands. It did under tsan (run 41663745469): nothing decrements the gauge in that test, so the 0 it read was the increment not having happened yet. Wait for the gauge to reach 1 before closing the client, so the check after the close is checking what it means to: that interrupting the handshake does not drop the outstanding SDS subscription. Signed-off-by: Ryan Northey <[email protected]>
phlax
force-pushed
the
test-on-demand-cert-active-wait
branch
from
November 3, 2026 16:48
2a45b21 to
72f759c
Compare
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the TLS handshake test timing change.
No open issues 🎉
What changed in this PR
Removes a timing race in the on-demand TLS ClientInterruptedHandshake integration test, so it checks that interrupting a handshake preserves the outstanding SDS subscription.
Changes:
- Waits for
cert_activeto reach 1 before closing the client. - Explains why waiting for
cert_requestedalone is insufficient.
| File | Description |
|---|---|
test/extensions/transport_sockets/tls/cert_selectors/on_demand/integration_test.cc |
Adds a gauge wait before interrupting the handshake to prevent a premature assertion. |
Review effort: Balanced
RyanTheOptimist
approved these changes
Nov 5, 2026
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 12, 2026
envoyproxy#48967) ClientInterruptedHandshake asserted cert_active == 1 straight after waitCertsRequested(1). The secret manager increments cert_requested and then cert_active on the main thread, so the test thread can see the counter at 1, close the client and read the gauge before the second increment lands. It did under tsan (run 41663745469): nothing decrements the gauge in that test, so the 0 it read was the increment not having happened yet. Wait for the gauge to reach 1 before closing the client, so the check after the close is checking what it means to: that interrupting the handshake does not drop the outstanding SDS subscription. Signed-off-by: Ryan Northey <[email protected]>
jwendell
pushed a commit
that referenced
this pull request
Nov 12, 2026
#48967) ClientInterruptedHandshake asserted cert_active == 1 straight after waitCertsRequested(1). The secret manager increments cert_requested and then cert_active on the main thread, so the test thread can see the counter at 1, close the client and read the gauge before the second increment lands. It did under tsan (run 41663745469): nothing decrements the gauge in that test, so the 0 it read was the increment not having happened yet. Wait for the gauge to reach 1 before closing the client, so the check after the close is checking what it means to: that interrupting the handshake does not drop the outstanding SDS subscription. Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 16, 2026
envoyproxy#48967) ClientInterruptedHandshake asserted cert_active == 1 straight after waitCertsRequested(1). The secret manager increments cert_requested and then cert_active on the main thread, so the test thread can see the counter at 1, close the client and read the gauge before the second increment lands. It did under tsan (run 41663745469): nothing decrements the gauge in that test, so the 0 it read was the increment not having happened yet. Wait for the gauge to reach 1 before closing the client, so the check after the close is checking what it means to: that interrupting the handshake does not drop the outstanding SDS subscription. Signed-off-by: Ryan Northey <[email protected]> (cherry picked from commit 71f29fe) Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 16, 2026
envoyproxy#48967) ClientInterruptedHandshake asserted cert_active == 1 straight after waitCertsRequested(1). The secret manager increments cert_requested and then cert_active on the main thread, so the test thread can see the counter at 1, close the client and read the gauge before the second increment lands. It did under tsan (run 41663745469): nothing decrements the gauge in that test, so the 0 it read was the increment not having happened yet. Wait for the gauge to reach 1 before closing the client, so the check after the close is checking what it means to: that interrupting the handshake does not drop the outstanding SDS subscription. Signed-off-by: Ryan Northey <[email protected]> (cherry picked from commit 71f29fe) Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 16, 2026
envoyproxy#48967) ClientInterruptedHandshake asserted cert_active == 1 straight after waitCertsRequested(1). The secret manager increments cert_requested and then cert_active on the main thread, so the test thread can see the counter at 1, close the client and read the gauge before the second increment lands. It did under tsan (run 41663745469): nothing decrements the gauge in that test, so the 0 it read was the increment not having happened yet. Wait for the gauge to reach 1 before closing the client, so the check after the close is checking what it means to: that interrupting the handshake does not drop the outstanding SDS subscription. Signed-off-by: Ryan Northey <[email protected]> (cherry picked from commit 71f29fe) Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 16, 2026
envoyproxy#48967) ClientInterruptedHandshake asserted cert_active == 1 straight after waitCertsRequested(1). The secret manager increments cert_requested and then cert_active on the main thread, so the test thread can see the counter at 1, close the client and read the gauge before the second increment lands. It did under tsan (run 41663745469): nothing decrements the gauge in that test, so the 0 it read was the increment not having happened yet. Wait for the gauge to reach 1 before closing the client, so the check after the close is checking what it means to: that interrupting the handshake does not drop the outstanding SDS subscription. Signed-off-by: Ryan Northey <[email protected]> Backport note: with this branch's `waitForGaugeEq` (`main`'s `waitForGauge` takes a matcher). (cherry picked from commit 71f29fe) Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 16, 2026
envoyproxy#48967) ClientInterruptedHandshake asserted cert_active == 1 straight after waitCertsRequested(1). The secret manager increments cert_requested and then cert_active on the main thread, so the test thread can see the counter at 1, close the client and read the gauge before the second increment lands. It did under tsan (run 41663745469): nothing decrements the gauge in that test, so the 0 it read was the increment not having happened yet. Wait for the gauge to reach 1 before closing the client, so the check after the close is checking what it means to: that interrupting the handshake does not drop the outstanding SDS subscription. Signed-off-by: Ryan Northey <[email protected]> Backport note: with this branch's `waitForGaugeEq` (`main`'s `waitForGauge` takes a matcher). (cherry picked from commit 71f29fe) Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 16, 2026
envoyproxy#48967) ClientInterruptedHandshake asserted cert_active == 1 straight after waitCertsRequested(1). The secret manager increments cert_requested and then cert_active on the main thread, so the test thread can see the counter at 1, close the client and read the gauge before the second increment lands. It did under tsan (run 41663745469): nothing decrements the gauge in that test, so the 0 it read was the increment not having happened yet. Wait for the gauge to reach 1 before closing the client, so the check after the close is checking what it means to: that interrupting the handshake does not drop the outstanding SDS subscription. Signed-off-by: Ryan Northey <[email protected]> Backport note: with this branch's `waitForGaugeEq` (`main`'s `waitForGauge` takes a matcher). (cherry picked from commit 71f29fe) Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 16, 2026
envoyproxy#48967) ClientInterruptedHandshake asserted cert_active == 1 straight after waitCertsRequested(1). The secret manager increments cert_requested and then cert_active on the main thread, so the test thread can see the counter at 1, close the client and read the gauge before the second increment lands. It did under tsan (run 41663745469): nothing decrements the gauge in that test, so the 0 it read was the increment not having happened yet. Wait for the gauge to reach 1 before closing the client, so the check after the close is checking what it means to: that interrupting the handshake does not drop the outstanding SDS subscription. Signed-off-by: Ryan Northey <[email protected]> Backport note: with this branch's `waitForGaugeEq` (`main`'s `waitForGauge` takes a matcher). (cherry picked from commit 71f29fe) Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 16, 2026
envoyproxy#48967) ClientInterruptedHandshake asserted cert_active == 1 straight after waitCertsRequested(1). The secret manager increments cert_requested and then cert_active on the main thread, so the test thread can see the counter at 1, close the client and read the gauge before the second increment lands. It did under tsan (run 41663745469): nothing decrements the gauge in that test, so the 0 it read was the increment not having happened yet. Wait for the gauge to reach 1 before closing the client, so the check after the close is checking what it means to: that interrupting the handshake does not drop the outstanding SDS subscription. Signed-off-by: Ryan Northey <[email protected]> Backport note: with this branch's `waitForGaugeEq` (`main`'s `waitForGauge` takes a matcher). (cherry picked from commit 71f29fe) Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 16, 2026
envoyproxy#48967) ClientInterruptedHandshake asserted cert_active == 1 straight after waitCertsRequested(1). The secret manager increments cert_requested and then cert_active on the main thread, so the test thread can see the counter at 1, close the client and read the gauge before the second increment lands. It did under tsan (run 41663745469): nothing decrements the gauge in that test, so the 0 it read was the increment not having happened yet. Wait for the gauge to reach 1 before closing the client, so the check after the close is checking what it means to: that interrupting the handshake does not drop the outstanding SDS subscription. Signed-off-by: Ryan Northey <[email protected]> Backport note: with this branch's `waitForGaugeEq` (`main`'s `waitForGauge` takes a matcher). (cherry picked from commit 71f29fe) Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 16, 2026
envoyproxy#48967) ClientInterruptedHandshake asserted cert_active == 1 straight after waitCertsRequested(1). The secret manager increments cert_requested and then cert_active on the main thread, so the test thread can see the counter at 1, close the client and read the gauge before the second increment lands. It did under tsan (run 41663745469): nothing decrements the gauge in that test, so the 0 it read was the increment not having happened yet. Wait for the gauge to reach 1 before closing the client, so the check after the close is checking what it means to: that interrupting the handshake does not drop the outstanding SDS subscription. Signed-off-by: Ryan Northey <[email protected]> Backport note: with this branch's `waitForGaugeEq` (`main`'s `waitForGauge` takes a matcher). (cherry picked from commit 71f29fe) Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 16, 2026
envoyproxy#48967) ClientInterruptedHandshake asserted cert_active == 1 straight after waitCertsRequested(1). The secret manager increments cert_requested and then cert_active on the main thread, so the test thread can see the counter at 1, close the client and read the gauge before the second increment lands. It did under tsan (run 41663745469): nothing decrements the gauge in that test, so the 0 it read was the increment not having happened yet. Wait for the gauge to reach 1 before closing the client, so the check after the close is checking what it means to: that interrupting the handshake does not drop the outstanding SDS subscription. Signed-off-by: Ryan Northey <[email protected]> Backport note: with this branch's `waitForGaugeEq` (`main`'s `waitForGauge` takes a matcher). (cherry picked from commit 71f29fe) Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 17, 2026
envoyproxy#48967) ClientInterruptedHandshake asserted cert_active == 1 straight after waitCertsRequested(1). The secret manager increments cert_requested and then cert_active on the main thread, so the test thread can see the counter at 1, close the client and read the gauge before the second increment lands. It did under tsan (run 41663745469): nothing decrements the gauge in that test, so the 0 it read was the increment not having happened yet. Wait for the gauge to reach 1 before closing the client, so the check after the close is checking what it means to: that interrupting the handshake does not drop the outstanding SDS subscription. Signed-off-by: Ryan Northey <[email protected]> (cherry picked from commit 71f29fe) Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 17, 2026
envoyproxy#48967) ClientInterruptedHandshake asserted cert_active == 1 straight after waitCertsRequested(1). The secret manager increments cert_requested and then cert_active on the main thread, so the test thread can see the counter at 1, close the client and read the gauge before the second increment lands. It did under tsan (run 41663745469): nothing decrements the gauge in that test, so the 0 it read was the increment not having happened yet. Wait for the gauge to reach 1 before closing the client, so the check after the close is checking what it means to: that interrupting the handshake does not drop the outstanding SDS subscription. Signed-off-by: Ryan Northey <[email protected]> Backport note: with this branch's `waitForGaugeEq` (`main`'s `waitForGauge` takes a matcher). (cherry picked from commit 71f29fe) Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 17, 2026
envoyproxy#48967) ClientInterruptedHandshake asserted cert_active == 1 straight after waitCertsRequested(1). The secret manager increments cert_requested and then cert_active on the main thread, so the test thread can see the counter at 1, close the client and read the gauge before the second increment lands. It did under tsan (run 41663745469): nothing decrements the gauge in that test, so the 0 it read was the increment not having happened yet. Wait for the gauge to reach 1 before closing the client, so the check after the close is checking what it means to: that interrupting the handshake does not drop the outstanding SDS subscription. Signed-off-by: Ryan Northey <[email protected]> Backport note: with this branch's `waitForGaugeEq` (`main`'s `waitForGauge` takes a matcher). (cherry picked from commit 71f29fe) Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
that referenced
this pull request
Nov 17, 2026
#48967) ClientInterruptedHandshake asserted cert_active == 1 straight after waitCertsRequested(1). The secret manager increments cert_requested and then cert_active on the main thread, so the test thread can see the counter at 1, close the client and read the gauge before the second increment lands. It did under tsan (run 41663745469): nothing decrements the gauge in that test, so the 0 it read was the increment not having happened yet. Wait for the gauge to reach 1 before closing the client, so the check after the close is checking what it means to: that interrupting the handshake does not drop the outstanding SDS subscription. Signed-off-by: Ryan Northey <[email protected]> Backport note: with this branch's `waitForGaugeEq` (`main`'s `waitForGauge` takes a matcher). (cherry picked from commit 71f29fe) Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 18, 2026
envoyproxy#48967) ClientInterruptedHandshake asserted cert_active == 1 straight after waitCertsRequested(1). The secret manager increments cert_requested and then cert_active on the main thread, so the test thread can see the counter at 1, close the client and read the gauge before the second increment lands. It did under tsan (run 41663745469): nothing decrements the gauge in that test, so the 0 it read was the increment not having happened yet. Wait for the gauge to reach 1 before closing the client, so the check after the close is checking what it means to: that interrupting the handshake does not drop the outstanding SDS subscription. Signed-off-by: Ryan Northey <[email protected]> Backport note: with this branch's `waitForGaugeEq` (`main`'s `waitForGauge` takes a matcher). (cherry picked from commit 71f29fe) Signed-off-by: Ryan Northey <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ClientInterruptedHandshake asserted cert_active == 1 straight after waitCertsRequested(1). The secret manager increments cert_requested and then cert_active on the main thread, so the test thread can see the counter at 1, close the client and read the gauge before the second increment lands. It did under tsan (run 41663745469): nothing decrements the gauge in that test, so the 0 it read was the increment not having happened yet.
Wait for the gauge to reach 1 before closing the client, so the check after the close is checking what it means to: that interrupting the handshake does not drop the outstanding SDS subscription.