Skip to content

Session leak when read-write statement-based transactions are retried #300

@thepaul

Description

@thepaul

Environment details

  • Programming language: Go
  • OS: macOS, Linux
  • Language runtime version: 1.23.2
  • Package version: 1.7.2

Steps to reproduce

  1. Use the Cloud Spanner emulator as the backend (it will abort queries more readily than the real Spanner).
  2. Start a transaction tx1.
  3. Execute a query (like SELECT 1) in tx1 that will cause a session to be opened. Leave that session open.
  4. Outside of any transaction context, execute another single-statement query, i.e. (SELECT 2).
  5. The SELECT 2 query will be aborted (because the emulator only supports one transaction at a time) and will go into an infinite retry loop using (*readWriteTransaction).retry() waiting for tx1 to close.
  6. Close tx1 (rollback or commit).
  7. If the SELECT 2 query has been retrying for long enough, it will have exhausted the limit on session handles and will block forever waiting for more. SELECT 2 will never complete. Also, no more sessions can be opened at this point.

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: p2Moderately-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.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions