[Spanner] Retries of UNAVAILABLE errors when resuming a result stream not working properly
Maintainer thường phản hồi trong vòng 1 ngày
@Hectorhammett đang làm issue này rồi.
Từ ngày 25/9/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Result::rows() can retry UNAVAILABLE errors forever, when the server keeps returning UNAVAILABLE after the first stream is interrupted. The retry limit from RetrySettings (default 3) is never applied.
This issue is a bit hard to explain but here goes...
The bit of code that needs fixing is here.
https://github.com/googleapis/google-cloud-php/blob/c891a48bd3bd3f132dd7bc3bc35ff73844743abb/Spanner/src/Result.php#L182
This block is called when a ServiceException is thrown with status UNAVAILABLE while iterating through the Generator returned from $call. I think the expected behavior here is to re-execute the $call, reconnect and resume the iterating process. At first glance it seemed like it's doing exactly that.
But when I actually run it, I noticed that when $call is actually invoked in ExponentialBackoff::execute($call, ...), it's just returning the Generator that is not started (see below).
Since the code inside the $call is not executed, the unstarted generator gets incorrectly assigned and the loop is continued. When $this->generator->current() is called again (Result.php:L138), and if another ServiceException (with status UNAVAILABLE) is thrown again, the whole process is repeated.
I think the expected behavior here is to have the generator start when $backoff->execute(...) is run so that backoff can actually be applied.
Result::createGenerator(...) run with a similar logic, but there the generator is started inside the callback so it runs correctly like so...
So I think this can be fixed by changing...
$this->generator = $backoff->execute($call, [$this->resumeToken, $this->transaction()]);
to
$this->generator = $backoff->execute(function () use ($call) {
$generator = $call();
$generator->valid();
return $generator;
});
Environment details
- OS: Alpine Linux
- PHP version: 8.5.10
- Package name and version: google/cloud-spanner v2.11.0
Steps to reproduce
- Run a large query using
Database::execute(...) - Call
rows() - Start iterating.
- Network disconnects and throw UNAVAILABLE midway.
- Ngôn ngữ chính
- PHP
- Star
- 1.2k
- Fork
- 464
- Merge trung bình
- 2 ngày 2 giờ
- Pull request đã merge (30 ngày)
- 84
Chuẩn bị môi trường
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của googleapis/google-cloud-php
-
type: feature request
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
googleapis/google-cloud-php#9716 · 11 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
googleapis/google-cloud-php#9739 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 65/100
googleapis/google-cloud-php#9725 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
googleapis/google-cloud-php#9675 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
googleapis/google-cloud-php#9674 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của googleapis/google-cloud-php
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Awaiting Triage
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
WordPress/two-factor#1008 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
sync-en
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày