Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(spanner): prevent possible panic for Session not found errors #10386

Merged
merged 2 commits into from
Jun 18, 2024

Conversation

olavloite
Copy link
Contributor

@olavloite olavloite commented Jun 17, 2024

The Spanner client library could panic if specifically the following situation would occur:

  1. Create a StmtBasedReadWriteTransaction
  2. Only execute mutations, so that an explicit BeginTransaction RPC is required.
  3. The BeginTransaction RPC returns "Session not found"
  4. The client library tries to get a new session from the pool.

Step 4 above would panic, because the client library did not set the readOnlyTransaction.sp field for StmtBasedReadWriteTransactions.

Fixes #10385

Also fixes googleapis/go-sql-spanner#262

The Spanner client library could panic if specifically the following
situation would occur:
1. Create a StmtBasedReadWriteTransaction
2. Only execute mutations, so that an explicit BeginTransaction
   RPC is required.
3. The BeginTransaction RPC returns "Session not found"
4. The client library tries to get a new session from the pool.

Step 4 above would panic, because the client library did not set the
readOnlyTransaction.sp field for StmtBasedReadWriteTransactions.

Fixes #10385
@olavloite olavloite requested review from a team as code owners June 17, 2024 15:04
@product-auto-label product-auto-label bot added the api: spanner Issues related to the Spanner API. label Jun 17, 2024
@olavloite olavloite requested a review from rahul2393 June 17, 2024 15:05
@rahul2393 rahul2393 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 18, 2024
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 18, 2024
@rahul2393 rahul2393 merged commit ba9711f into main Jun 18, 2024
11 of 12 checks passed
@rahul2393 rahul2393 deleted the spanner-prevent-panic-for-session-not-found branch June 18, 2024 04:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the Spanner API.
Projects
None yet
3 participants