You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: java-bigtable/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/session/SessionImpl.java
+63Lines changed: 63 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -78,6 +78,21 @@ public class SessionImpl implements Session, VRpcSessionApi {
78
78
.setDescription("missed heartbeat")
79
79
.build();
80
80
81
+
@VisibleForTesting
82
+
// Upper bound on how long a session may remain STARTING before we give up on the open handshake
83
+
// and force-close it. Without this, a stream that connects but never delivers the OpenSession
84
+
// response (or a GoAway) leaves the session wedged in STARTING forever, holding the
85
+
// session-creation-budget slot it reserved and never firing the terminal callback that would
86
+
// release it. Force-closing routes STARTING -> WAIT_SERVER_CLOSE -> onSessionClose, which frees
Copy file name to clipboardExpand all lines: java-bigtable/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/session/SessionList.java
Copy file name to clipboardExpand all lines: java-bigtable/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/session/SessionPoolImpl.java
+70-10Lines changed: 70 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -175,6 +175,18 @@ private enum PoolState {
175
175
@GuardedBy("poolLock")
176
176
privatefinalSessionCreationBudgetbudget;
177
177
178
+
// Handles that reserved a session-creation budget slot in createSession() and have not yet
179
+
// released it. A slot is released exactly once: as a success when the session reaches READY
180
+
// (onSessionReady), or as a failure when the session terminates without ever becoming READY
181
+
// (onSessionClose). Tracking the reservation on the handle -- instead of inferring it from the
182
+
// close-time prevState -- is what makes the release exactly-once: a session that goes
183
+
// STARTING -> WAIT_SERVER_CLOSE (e.g. a server GO_AWAY before the open handshake completes)
184
+
// closes with prevState == WAIT_SERVER_CLOSE, which the abnormal-close branch skips, so the
185
+
// prevState == STARTING check alone would leak the slot forever. SessionHandle uses identity
186
+
// equality, so a plain HashSet keys on the handle instance.
Copy file name to clipboardExpand all lines: java-bigtable/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/internal/session/SessionImplTest.java
0 commit comments