KEMBAR78
fix: update grpc WriteObject response handling to provide context when a failure happens by BenWhitehead · Pull Request #2532 · googleapis/java-storage · GitHub
Skip to content

Conversation

@BenWhitehead
Copy link
Collaborator

Follow up to #2527

This updated errors from grpc chunked uploads to have messages that include useful debugging information.

When a response is received but doesn't validate with the expected state:

com.google.cloud.storage.StorageException: Attempt to append to already finalized resumable session.
	|> [
	|> 	com.google.storage.v2.WriteObjectRequest{
	|> 		upload_id: uploadId
	|> 		checksummed_data: {range: [0:262144]}
	|> 	}
	|> ]
	|  
	|< com.google.storage.v2.WriteObjectResponse{
	|< 	resource {
	|< 	  name: "obj"
	|< 	  size: 524288
	|< 	}
	|< }
	|

When an error is returned by GCS:

com.google.cloud.storage.StorageException: Client side data loss detected. Attempt to append to a resumable session with an offset higher than the backend has
	|> [
	|> 	com.google.storage.v2.WriteObjectRequest{
	|> 		upload_id: uploadId
	|> 		checksummed_data: {range: [262144:524288]}
	|> 	}
	|> ]
	|  
	|< Status{code=OUT_OF_RANGE, description=Upload request started at offset '262144', which is past expected offset '0'., cause=null}
	|< Metadata(content-type=application/grpc)
	| 

Also update exception propagation to add original call context as a suppressed exception in order to allow maintaining originating frames of the async failure.

@BenWhitehead BenWhitehead added the owlbot:ignore instruct owl-bot to ignore a PR label May 7, 2024
@BenWhitehead BenWhitehead requested a review from a team as a code owner May 7, 2024 21:21
@product-auto-label product-auto-label bot added size: l Pull request size is large. api: storage Issues related to the googleapis/java-storage API. labels May 7, 2024
Base automatically changed from grpc-stricter-response-validation to main May 7, 2024 21:28
@BenWhitehead BenWhitehead force-pushed the grpc-stricter-response-validation-better-messages branch from e4ad8c1 to 8bfc3f0 Compare May 7, 2024 21:56
@BenWhitehead BenWhitehead merged commit 170a3f5 into main May 8, 2024
@BenWhitehead BenWhitehead deleted the grpc-stricter-response-validation-better-messages branch May 8, 2024 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: storage Issues related to the googleapis/java-storage API. owlbot:ignore instruct owl-bot to ignore a PR size: l Pull request size is large.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants