[java-bigquery] getQueryResults does not retry a SocketTimeoutException (read timeout)
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 72/100
Rechercherichtung
Beginne bei BigQueryBaseService.BIGQUERY_EXCEPTION_HANDLER in google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryBaseService.java, wo retryOn ConnectException, UnknownHostException und SocketException auflistet; SocketTimeoutException fehlt. Prüfe, ob der Handler verschachtelte Ursachen entpackt, bevor er abgleicht, und füge dann den read-timeout-Fall (oder sein Äquivalent) mit denselben Retry-Einstellungen hinzu. Fertig sieht so aus: ein Unit-Test im bigquery-Modul, der bestätigt, dass ein getQueryResults-Aufruf, der mit einer SocketTimeoutException fehlschlägt, wiederholt wird, statt beim ersten Versuch geworfen zu werden; der gax-Interrupt-Defekt wird separat in #12860 / PR #14578 verfolgt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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)
- Vorherrschende Sprache
- Java
- Sterne
- 2.1k
- Forks
- 1.2k
- Ø Merge
- 2 T. 10 Std.
- Gemergte PRs (30 T.)
- 147
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus googleapis/google-cloud-java
-
gax-grpc: Surefire <test> pattern restricts the unit test run to a single testEvtl. vergeben @macastelaz hat das vor 5 Tagen übernommen. Offenpriority: p3 type: bug
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 94/100
googleapis/google-cloud-java#14572 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
[java-firestore] CustomClassMapper.convertBigDecimal calls .abs() on Double, unintentionally flipping negative values to positiveEvtl. vergeben @wu-hui hat das vor 7 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
googleapis/google-cloud-java#14533 · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
Github CI failing when trying to install xmllintEvtl. vergeben @blakeli0 hat das vor 43 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
googleapis/google-cloud-java#14132 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
BigQuery: create() throws NullPointerException on a duplicate job id outside the US multi-region (java-bigquery#3034 not fixed by #3035)Evtl. vergeben @laughingman7743 hat das vor 58 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
googleapis/google-cloud-java#14025 ·
Maintainer antworten meist innerhalb von 1 Tag
-
priority: p2 type: bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
googleapis/google-cloud-java#13255 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in googleapis/google-cloud-java
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
jenkinsci/ec2-plugin#2041 ·
-
L: github:actions L: php:composer
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
dependabot/dependabot-core#16493 ·
Maintainer antworten meist innerhalb von 1 Tag
-
SHOW EDIT of a subclass for an object of its superclass: the form fails to open with AssertionErrorOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 72/100
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 78/100
FlashyReese/sodium-extra#608 ·