googleapis / googleapis/google-cloud-python

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

Đang mở Phù hợp với người mới
#18,375 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
priority: p2 type: bug
Ngôn ngữ chính
Python
Star
5.4k
Fork
1.8k
Merge trung bình
3 ngày 4 giờ
Pull request đã merge (30 ngày)
122

Mô tả

### 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_

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
databases
Loại issue
Lỗi
Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
72/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.