[java-bigquery] getQueryResults does not retry a SocketTimeoutException (read timeout)
維護者通常 1 天內回覆
@lqiu96 已經在處理了。
開始於 2026年10月20日。
評估
研究方向
從 google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryBaseService.java 中的 BigQueryBaseService.BIGQUERY_EXCEPTION_HANDLER 開始,其中 retryOn 列出了 ConnectException、UnknownHostException 和 SocketException;SocketTimeoutException 缺失。檢查該處理器在匹配之前是否會解包巢狀原因,然後使用相同的重試設定加入 read-timeout 情況(或其等價物)。完成的樣子是:bigquery 模組中的一個單元測試斷言,以 SocketTimeoutException 失敗的 getQueryResults 呼叫會被重試,而不是在第一次嘗試時拋出;gax 中斷缺陷單獨在 #12860 / PR #14578 中追蹤。
由索引模型根據 Issue 內容生成。
描述
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)
- 主要語言
- Java
- 星號
- 2.1k
- 分支
- 1.2k
- 平均合併
- 2 天 5 小時
- 30 天內合併 PR
- 128
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
googleapis/google-cloud-java 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 78/100
googleapis/google-cloud-java#14636 ·
維護者通常 1 天內回覆
-
[java-firestore] UserDataConverter encodes a pre-epoch Date with negative nanos, so the write is refused可能已有人在做 @wu-hui 於 6 天前認領。 未關閉priority: p2 type: bug
難度 2/5 1-3 小時 新手友好度 75/100
googleapis/google-cloud-java#14635 · 已指派 1 人 ·
維護者通常 1 天內回覆
-
[java-firestore] UserDataConverter throws IndexOutOfBoundsException on an empty __binary__ value可能已有人在做 @wu-hui 於 6 天前認領。 未關閉priority: p2 type: bug
難度 2/5 1-3 小時 新手友好度 74/100
googleapis/google-cloud-java#14634 · 1 則留言 · 已指派 1 人 ·
維護者通常 1 天內回覆
-
[java-firestore] CustomClassMapper.convertBigDecimal calls .abs() on Double, unintentionally flipping negative values to positive可能重新可做 @wu-hui 於 28 天前認領,目前沒有進行中的 PR。 未關閉
難度 2/5 1-3 小時 新手友好度 85/100
googleapis/google-cloud-java#14533 · 已指派 1 人 ·
維護者通常 1 天內回覆
-
Github CI failing when trying to install xmllint可能已有人在做 @blakeli0 於 63 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 65/100
googleapis/google-cloud-java#14132 · 1 則留言 ·
維護者通常 1 天內回覆
查看 googleapis/google-cloud-java 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 68/100
strimzi/strimzi-kafka-operator#13328 · 1 則留言 · 3 個 reaction ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 67/100
OpenLiberty/ci.maven#2137 ·
維護者通常 1 天內回覆
-
Payer adjustment can exceed the balance left after copay and deductible, so claim payments add up to more than the charge可能已有人在做 @DG47 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 79/100
synthetichealth/synthea#1772 ·
維護者通常 13 天內回覆
-
難度 2/5 1-3 小時 新手友好度 72/100
geonetwork/core-geonetwork#9592 ·
維護者通常 2 天內回覆
-
難度 2/5 1-3 小時 新手友好度 75/100
NationalSecurityAgency/ghidra#10040 ·
維護者通常 2 天內回覆