Repository navigation
Conversation
lqiu96
force-pushed
the
fix/bq-retry-allowlist-structured-errors
branch
from
October 22, 2026 22:00
68db3f1 to
b5bf72e
Compare
lqiu96
force-pushed
the
fix/bq-retry-allowlist-structured-errors
branch
from
October 23, 2026 04:12
23c0272 to
3796a34
Compare
…omments, and remove unused helpers
lqiu96
force-pushed
the
fix/bq-retry-allowlist-structured-errors
branch
from
October 23, 2026 04:36
3796a34 to
9a4dcd9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request addresses the BigQuery exception handling and retry allowlist gaps identified in issue googleapis#14579.
Summary of Changes
SocketTimeoutExceptionandEOFExceptiontoDEFAULT_BIGQUERY_EXCEPTION_HANDLERinBigQueryBaseService.SocketTimeoutExceptionis a subclass ofInterruptedIOExceptionrather thanSocketExceptionin the JDK hierarchy, andEOFExceptionis a direct subclass ofIOException. Both represent transient network failures that were previously omitted from the default handler.BigQueryDirectRetryingExecutorinBigQueryRetryHelperto catchSocketTimeoutExceptionseparately beforeInterruptedIOException. GAXDirectRetryingExecutorcatchesInterruptedIOExceptionand callsThread.currentThread().interrupt()beforeretryingFuture.setAttemptFuture(...), which causesBasicRetryingFutureto see the thread as interrupted and abort the retry loop with anInterruptedExceptioninstead of evaluatingshouldRetry.BigQueryException.RETRYABLE_ERRORSwith the six core BigQuery SLA and error troubleshooting guide reasons (rateLimitExceeded,userRateLimitExceeded,jobRateLimitExceeded,backendError,internalError, andbadGateway) and HTTP status codes429,500,502,503, and504.BigQueryException.isRetryable()to checkRETRYABLE_ERRORS(includingHttpResponseExceptionstatus codes whengetCode()isUNKNOWN_CODE) as well asSocketTimeoutExceptionandEOFExceptioncauses.BigQueryRetryAlgorithm.shouldRetryBasedOnResultto evaluateBigQueryException.isRetryable()and removes the 16 per-call-siteBigQueryRetryHelper.maybeWrapForHttpRetrywrappers inBigQueryImpl.Job.waitForQueryResultsto check((BigQueryException) prevThrowable).isRetryable()when polling query results.BigQueryExceptionTest,BigQueryImplTest, andJobTest.Interaction with
SkipExceptionTranslationandmaybeWrapForHttpRetryWhy
SkipExceptionTranslationwas introduced (PR Exception in thread "main" java.lang.IllegalArgumentException: Jetty ALPN/NPN has not been properly configured googleapis/google-cloud-java#3668):Originally,
HttpBigQueryRpccaughtIOExceptioninside every RPC method and threwnew BigQueryException(ioException)upfront. BecauseExceptionHandler.shouldRetryonly checks the top-level thrown exception class (ex.getClass()) against itsretriableExceptionsset and does not inspectex.getCause(), wrapping anUnknownHostExceptioninto aBigQueryExceptionhid theUnknownHostExceptionclass fromDEFAULT_BIGQUERY_EXCEPTION_HANDLER. PR Exception in thread "main" java.lang.IllegalArgumentException: Jetty ALPN/NPN has not been properly configured googleapis/google-cloud-java#3668 added the*SkipExceptionTranslationmethods onBigQueryRpcso that the callable insideBigQueryRetryHelper.runWithRetriesthrows rawIOExceptionduring the retry loop, and translates toBigQueryExceptiononly after retries are exhausted.Why
SkipExceptionTranslationbrokeBigQueryException.RETRYABLE_ERRORS(PR fix(bigquery): retry cancel job and routine creation on transient HTTP 5xx errors googleapis/google-cloud-java#13416):A side effect of PR Exception in thread "main" java.lang.IllegalArgumentException: Jetty ALPN/NPN has not been properly configured googleapis/google-cloud-java#3668 was that
GoogleJsonResponseExceptionandHttpResponseException(which are subclasses ofIOException, notBaseServiceException) were no longer translated intoBigQueryExceptionbeforeDEFAULT_BIGQUERY_EXCEPTION_HANDLERevaluated them. BecauseBaseService.EXCEPTION_HANDLER_INTERCEPTORonly checksif (exception instanceof BaseServiceException), raw HTTP500,502,503, and504responses bypassedBigQueryException.RETRYABLE_ERRORSand were only retried if their error message happened to match a regex inBigQueryRetryConfig. PR fix(bigquery): retry cancel job and routine creation on transient HTTP 5xx errors googleapis/google-cloud-java#13416 addedBigQueryRetryHelper.maybeWrapForHttpRetryon 16 call sites inBigQueryImplto translateIOExceptionintoBigQueryExceptionwhenresultAlgorithm == DEFAULT_BIGQUERY_EXCEPTION_HANDLER.How
BigQueryRetryAlgorithm.shouldRetryBasedOnResultpreserves both behaviors:BigQueryRetryAlgorithm.shouldRetryBasedOnResultevaluatesgetResultAlgorithm().shouldRetry(previousThrowable, previousResponse)first on the rawpreviousThrowable.UnknownHostException,SocketException,SocketTimeoutException, andEOFException(as well as any customExceptionHandlerorResultRetryAlgorithmconfigured viaBigQueryOptions.setResultRetryAlgorithm),getResultAlgorithm().shouldRetry(...)sees the rawIOExceptiondirectly, preserving PR Exception in thread "main" java.lang.IllegalArgumentException: Jetty ALPN/NPN has not been properly configured googleapis/google-cloud-java#3668 (SkipExceptionTranslation) and custom user retry configurations.getResultAlgorithm().shouldRetry(...)returnsfalseand the caller is usingDEFAULT_BIGQUERY_EXCEPTION_HANDLERdoesBigQueryRetryAlgorithmevaluatenew BigQueryException((IOException) previousThrowable).isRetryable()as a read-only predicate (without mutatingpreviousThrowable) to check HTTP status codes (429,500,502,503,504) and structured JSON error reasons (rateLimitExceeded,backendError, etc.) across all*SkipExceptionTranslationRPCs uniformly.