[java-bigquery] getQueryResults does not retry a SocketTimeoutException (read timeout)
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
从 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 天 10 小时
- 30 天内合并 PR
- 147
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
googleapis/google-cloud-java 的其他 Issue
-
gax-grpc: Surefire <test> pattern restricts the unit test run to a single test可能已有人在做 @macastelaz 于 4 天前认领。 未关闭priority: p3 type: bug
难度 1/5 1 小时以内 新手友好度 94/100
googleapis/google-cloud-java#14572 · 1 条评论 ·
维护者通常 1 天内回复
-
[java-firestore] CustomClassMapper.convertBigDecimal calls .abs() on Double, unintentionally flipping negative values to positive可能已有人在做 @wu-hui 于 6 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 85/100
googleapis/google-cloud-java#14533 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Github CI failing when trying to install xmllint可能已有人在做 @blakeli0 于 42 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 65/100
googleapis/google-cloud-java#14132 · 1 条评论 ·
维护者通常 1 天内回复
-
BigQuery: create() throws NullPointerException on a duplicate job id outside the US multi-region (java-bigquery#3034 not fixed by #3035)可能已有人在做 @laughingman7743 于 56 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
googleapis/google-cloud-java#14025 ·
维护者通常 1 天内回复
-
priority: p2 type: bug
难度 2/5 1-3 小时 新手友好度 78/100
googleapis/google-cloud-java#13255 · 2 条评论 ·
维护者通常 1 天内回复
查看 googleapis/google-cloud-java 的全部 Issue
相似的 Issue
-
enhancement
难度 1/5 1 小时以内 新手友好度 88/100
helidon-io/helidon#12721 ·
维护者通常 1 天内回复
-
status: team-only type: dependency-upgrade
难度 2/5 1-3 小时 新手友好度 64/100
spring-projects/spring-boot#51966 ·
维护者通常 1 天内回复
-
Missing repro Platform: Android
难度 2/5 1-3 小时 新手友好度 78/100
software-mansion/react-native-reanimated#10816 · 2 条评论 ·
维护者通常 1 天内回复
-
area/docs backport/26.6 backport/26.8 kind/bug status/triage
难度 1/5 1 小时以内 新手友好度 75/100
维护者通常 1 天内回复
-
[destination-snowflake] Custom domains rejected unlike source connections可能已有人在做 @kuza55 今天认领。 未关闭autoteam community connectors/destination/snowflake team/use
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复