[java-bigquery] getQueryResults does not retry a SocketTimeoutException (read timeout)
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 72/100
Hướng nghiên cứu
Bắt đầu tại BigQueryBaseService.BIGQUERY_EXCEPTION_HANDLER trong google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryBaseService.java, nơi retryOn liệt kê ConnectException, UnknownHostException và SocketException; SocketTimeoutException vắng mặt. Kiểm tra xem handler có mở gói các nguyên nhân lồng nhau trước khi khớp không, sau đó thêm trường hợp read-timeout (hoặc tương đương của nó) với cùng cài đặt retry. Hoàn thành trông giống như một unit test trong mô-đun bigquery khẳng định rằng một lệnh gọi getQueryResults thất bại với SocketTimeoutException được thử lại thay vì bị ném ở lần thử đầu tiên; lỗi interrupt của gax được theo dõi riêng trong #12860 / PR #14578.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Issue Details
BigQueryBaseService.BIGQUERY_EXCEPTION_HANDLER retries ConnectException, UnknownHostException and SocketException, but not SocketTimeoutException. So when one getQueryResults call inside Job.waitFor takes longer than the HTTP read timeout, the query fails at once with BigQueryException: Read timed out, after one attempt. A read timeout on this idempotent poll is as transient as a SocketException, and the job itself is still running.
Job.waitFor calls getQueryResults with no timeoutMs, so BigQuery holds each call for up to 10 s. java-bigquery sets the HTTP read timeout to 60,000 ms by default. A poll that gets no answer within 60 s, most likely a connection that died, fails the whole query, although the job is still running and the next poll would succeed. A longer read timeout does not help a dead connection. Only a retry does.
Edited 2026-10-04: an earlier version said the default read timeout is 20,000 ms. It is 60,000 ms.
Today a second defect hides this one: gax turns the SocketTimeoutException into a thread interrupt, so the caller sees BigQueryException: java.lang.InterruptedException instead (#12860, PR #14578). With that gax fix applied, the same stall fails with Read timed out after one attempt. That remaining failure is this issue.
Expected: getQueryResults (and other idempotent reads) retries a SocketTimeoutException under the same retry settings as a SocketException.
Environment
- OS Type and Version: macOS 26.6.2 (arm64)
- Java Version and JDK Vendor: OpenJDK 25 (2025-09-16 LTS)
- Deployment: a JVM server that calls BigQuery through
com.google.cloud:google-cloud-bigquery, with Application Default Credentials.
Dependencies
- Client library:
com.google.cloud:google-cloud-bigquery2.54.1 (not using libraries-bom). The handler is the same onmaintoday. - Gax:
gaxandgax-httpjson2.84.0 - Auth:
google-auth-library-oauth2-http1.37.1 to 1.51.0 - Google-Http-Java-Client: 1.47.1 to 2.2.0
Reproducer
- Build a
BigQueryclient with a short HTTP read timeout, for example 2 s, throughHttpTransportOptions. - Run a query, and call
job.waitFor()while BigQuery holdsgetQueryResults(any query that takes more than 2 s). - With a gax that has the #14578 fix,
waitForthrowsBigQueryException: Read timed out(causejava.net.SocketTimeoutException) after one attempt. With current gax, it throwsBigQueryException: java.lang.InterruptedException.
The same wait with the default timeout succeeds. The handler in question is in google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryBaseService.java:
.abortOn(RuntimeException.class)
.retryOn(java.net.ConnectException.class)
.retryOn(java.net.UnknownHostException.class)
.retryOn(java.net.SocketException.class)
- Ngôn ngữ chính
- Java
- Star
- 2.1k
- Fork
- 1.2k
- Merge trung bình
- 2 ngày 10 giờ
- Pull request đã merge (30 ngày)
- 147
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
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-java
-
gax-grpc: Surefire <test> pattern restricts the unit test run to a single testCó thể đã có người làm @macastelaz đã nhận 4 ngày trước. Đang mởpriority: p3 type: bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 94/100
googleapis/google-cloud-java#14572 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[java-firestore] CustomClassMapper.convertBigDecimal calls .abs() on Double, unintentionally flipping negative values to positiveCó thể đã có người làm @wu-hui đã nhận 6 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
googleapis/google-cloud-java#14533 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Github CI failing when trying to install xmllintCó thể đã có người làm @blakeli0 đã nhận 42 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
googleapis/google-cloud-java#14132 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
BigQuery: create() throws NullPointerException on a duplicate job id outside the US multi-region (java-bigquery#3034 not fixed by #3035)Có thể đã có người làm @laughingman7743 đã nhận 57 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
googleapis/google-cloud-java#14025 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
priority: p2 type: bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
googleapis/google-cloud-java#13255 · 2 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-java
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
jenkinsci/gitlab-plugin#1950 ·
-
It's not necessary to copy the memory block in the readWrite() of org.h2.store.fs.mem.FileMemDataĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
h2database/h2database#4435 ·
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
micronaut-projects/micronaut-core#13717 ·
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 72/100
ADORSYS-GIS/token-status-link#145 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
enhancement
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
helidon-io/helidon#12721 ·
Maintainer thường phản hồi trong vòng 1 ngày