Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test(spanner): unflake DynamicChannelPoolPrimeSessionTest (#14278)
In
`sessionArrivingAfterFailedClientConstructionNeverBecomesPrimeSession`,
`arrivedBeforeRelease` was sampled immediately after `getDatabaseClient`
timed out from waiting for multiplexed session creation (200ms).

Under thread scheduling contention or high CI load, the asynchronous
`CreateSession` gRPC call dispatched by `SessionClient` could take
longer than 200ms to reach the mock server. As a result,
`arrivedBeforeRelease` sampled 0 instead of 1. When the gate was later
released, the delayed RPC finally arrived at
`mockSpanner.createSession()`, incrementing the count and causing
`assertEquals(arrivedBeforeRelease,
mockSpanner.arrivedCreateSessions.get())` to fail with `AssertionError:
expected:<0> but was:<1>`.

Fix this race condition by explicitly waiting for the in-flight
`CreateSession` RPC to arrive at `mockSpanner` before sampling
`arrivedBeforeRelease` and releasing the gate.
  • Loading branch information
sakthivelmanii authored and lqiu96 committed Nov 2, 2026
commit 96fa0eebfa87080d5a7c190dcaf1ac9e9a5f3c6e
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ public void sessionArrivingAfterFailedClientConstructionNeverBecomesPrimeSession
// arrives.
assertThat(waitingRpc.getPrimeSessionSourceCount()).isEqualTo(0);

awaitCondition(() -> mockSpanner.arrivedCreateSessions.get() >= 1);
int arrivedBeforeRelease = mockSpanner.arrivedCreateSessions.get();
mockSpanner.releaseCreateSessions();
awaitCondition(() -> waitingRpc.getCompletedMultiplexedCreateSessions() >= 1);
Expand Down
⌂ 换网址