A client called `run_in_transaction` be stuck if Spanner is down

Open Beginner friendly
#18,375 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
python
Domain
databases

Research direction

Start in packages/google-cloud-spanner/google/cloud/spanner_v1/database.py at run_in_transaction and its get_session call. Trace the transaction-running state when session creation fails while Spanner is unavailable, then add coverage for that failure path. Done means the client does not remain stuck and can retry when Spanner becomes available.

Written by the indexing model from the issue text.

Description

priority: p2 type: bug
Determine this is the right repository
  • I determined this is the correct repository in which to report this bug.
Summary of the issue

Context
When the Spanner is unavailable. If we call run_in_transaction, the Spanner client will stuck forever.

We believe the get_session should in the try catch block. Otherwise, the self._local.transaction_running = True will be forever True.

Expected Behavior:
The client will retry when the Spanner DB is back.

Actual Behavior:
The client stuck forever.

API client name and version

No response

Reproduction steps: code

No response

Reproduction steps: supporting files
  • Try to create a session when Spanner is unavailable.
  • The client will be stuck forever.
Reproduction steps: actual results

No response

Reproduction steps: expected results

No response

OS & version + platform

No response

Python environment

No response

Python dependencies

No response

Additional context

No response

Dominant language
Python
Stars
5.4k
Forks
1.8k
Avg merge
1d 17h
Merged PRs (30d)
93

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from googleapis/google-cloud-python

All issues in googleapis/google-cloud-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.