-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Spanner: Exception on BeginTransaction rpc can cause session leak #6164
Copy link
Copy link
Closed
Labels
api: spannerIssues related to the Spanner API.Issues related to the Spanner API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
Activity
Metadata
Metadata
Assignees
Labels
api: spannerIssues related to the Spanner API.Issues related to the Spanner API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
If an exception that cannot be retried occurs while executing the BeginTransaction gRPC, the Spanner session pool could leak a session.
Consider the following example:
The above session pool will never contain a prepared transaction, as the writeSessionsFraction is set to 0. Creating a read/write transaction will therefore always require the session pool to prepare a new session. If the BeginTransaction rpc returns a non-retryable error, the error is returned to the client, but the session that is taken to be prepared by the session pool is never returned to the session pool.