Skip to content

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

Merged
rahul2393 merged 2 commits intomainfrom
spanner-prevent-panic-for-session-not-found
Jun 18, 2024
Merged

fix(spanner): prevent possible panic for Session not found errors#10386
rahul2393 merged 2 commits intomainfrom
spanner-prevent-panic-for-session-not-found

Conversation

@olavloite
Copy link
Copy Markdown
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 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
@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