Core: treat gRPC ResourceExhausted 'message larger than max' as non-r… - #718
Open
mnnekrashevich wants to merge 1 commit into
Open
Conversation
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.
Core: treat gRPC ResourceExhausted "message larger than max" as non-retryable
Fixes #621
Problem
When sending a large payload (e.g. UPSERT with a
$dataparameter exceeding the gRPC message limit),the driver returns
ResourceExhausted("trying to send message larger than max"). This error iscurrently classified as retryable, so the SDK retries it with slow backoff up to
maxRetriestimes.Since the payload size does not change between attempts, every retry fails identically — the operation
effectively hangs until timeout or context cancellation, instead of failing fast.
Root cause
RESOURCE_EXHAUSTEDis unconditionally mapped toStatusCode.CLIENT_RESOURCE_EXHAUSTEDinGrpcStatuses.getStatusCode(). That status is inRETRYABLE_STATUSESand mapped to slow backoff inYdbRetryConfigand bothSessionRetryContextimplementations, so the retry loop never distinguishesthe deterministic "message too large" case from transient server-side resource exhaustion.
Fix
In
GrpcStatuses.getStatusCode(), inspect the gRPC status description when the code isRESOURCE_EXHAUSTEDand map the message-size-limit variants toBAD_REQUEST(non-retryable),mirroring the fix already merged in the Go SDK (ydb-platform/ydb-go-sdk#2105):
All other
ResourceExhaustederrors (quota, rate limiting) keep the existing behavior and remain retryable.Tests
Added to
GrpcStatusesTest: send/receive variants map toBAD_REQUEST, other descriptions keepCLIENT_RESOURCE_EXHAUSTED. Verified with./mvnw test(all modules, BUILD SUCCESS).