googleapis / googleapis/google-cloud-python

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

オープン 初心者向け
#18,375 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
priority: p2 type: bug
主要言語
Python
スター
5.4k
フォーク
1.8k
平均マージ
3日 4時間
マージ済み PR(30日)
122

説明

### Determine this is the right repository

- [x] 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`](https://github.com/googleapis/google-cloud-python/blob/main/packages/google-cloud-spanner/google/cloud/spanner_v1/database.py#L1015), the Spanner client will stuck forever.

We believe the [get_session](https://github.com/googleapis/google-cloud-python/blob/main/packages/google-cloud-spanner/google/cloud/spanner_v1/database.py#L1064) 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_

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
databases
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
活発
明瞭さ
おおむね明確
初心者へのやさしさ
72/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。