Skip to content

fix(storage): add server closed idle connection to retriable errors#14594

Merged
cpriti-os merged 3 commits into
googleapis:mainfrom
meet2mky:fix-idle-connection
May 18, 2026
Merged

fix(storage): add server closed idle connection to retriable errors#14594
cpriti-os merged 3 commits into
googleapis:mainfrom
meet2mky:fix-idle-connection

Conversation

@meet2mky

Copy link
Copy Markdown
Contributor

Description

This PR adds server closed idle connection to the list of retriable socket-level network errors in the Cloud Storage client library.

When the standard Go HTTP transport attempts to reuse a TCP keep-alive connection that GCS has closed due to an idle timeout, it returns a *url.Error containing the error message:
http: server closed idle connection

Because GCS does not classify this specific string as retriable, the entire write/upload operation immediately fails without retrying, even when idempotent preconditions (such as IfGenerationMatch or DoesNotExist) are configured.

Changes

  • storage/invoke.go: Added "server closed idle connection" to the retriable slice inside ShouldRetry(err error).
  • storage/invoke_test.go: Added explicit unit tests to TestShouldRetry verifying that both direct and wrapped "server closed idle connection" errors are correctly identified as retriable.

Verification

Added unit test cases in storage/invoke_test.go pass successfully:

go test -v -short -run TestShouldRetry

@meet2mky meet2mky requested review from a team as code owners May 15, 2026 05:21
@product-auto-label product-auto-label Bot added the api: storage Issues related to the Cloud Storage API. label May 15, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the ShouldRetry logic in storage/invoke.go to include 'server closed idle connection' as a retriable error, accompanied by new test cases in storage/invoke_test.go. The feedback suggests updating the surrounding documentation to reflect that the function now handles both socket and transport-level network errors, as the existing comment is now partially outdated.

Comment thread storage/invoke.go
Comment thread storage/invoke_test.go
@cpriti-os cpriti-os changed the title storage: add server closed idle connection to retriable errors fix(storage): add server closed idle connection to retriable errors May 18, 2026
@meet2mky meet2mky requested a review from cpriti-os May 18, 2026 10:14
@cpriti-os cpriti-os merged commit a6bd392 into googleapis:main May 18, 2026
11 checks passed
@meet2mky meet2mky deleted the fix-idle-connection branch May 19, 2026 02:42
cpriti-os added a commit that referenced this pull request May 21, 2026
PR created by the Librarian CLI to initialize a release. Merging this PR
will auto trigger a release.

Librarian Version: v0.14.0
Language Image:
us-central1-docker.pkg.dev/cloud-sdk-librarian-prod/images-prod/librarian-go@sha256:19bb93e8f1f916c61b597db2bad65dc432f79baaabb210499d7d0e4ad1dffe29
<details><summary>storage: v1.61.4</summary>

##
[v1.61.4](storage/v1.61.3...storage/v1.61.4)
(2026-05-21)

### Bug Fixes

* add server closed idle connection to retriable errors (#14594)
([37580e7](37580e7e))

</details>
krishnamd-jkp added a commit that referenced this pull request Jun 4, 2026
PR created by the Librarian CLI to initialize a release. Merging this PR
will auto trigger a release.

Librarian Version: v0.16.0
Language Image:
us-central1-docker.pkg.dev/cloud-sdk-librarian-prod/images-prod/librarian-go@sha256:b04b076f5eedbb5546bd6fc1404969dd3698c8b19c0f34ae815a84ae735a606a
<details><summary>storage: v1.62.3</summary>

##
[v1.62.3](storage/v1.62.2...storage/v1.62.3)
(2026-06-03)

### Bug Fixes

* fix race condition during retries in gRPC writer (#14649)
([04b6c63](04b6c635))

* add server closed idle connection to retriable errors (#14594)
([20b37d6](20b37d65))

</details>
krishnamd-jkp added a commit that referenced this pull request Jun 26, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.63.0](storage/v1.62.2...storage/v1.63.0)
(2026-06-25)


### Features

* **go:** Add full object checksum for negative offsets &gt; size
([#20026](#20026))
([a04d980](a04d980))
* **storage:** Add client feature tracking in HTTP client
([#14691](#14691))
([319cc4c](319cc4c))
* **storage:** App Centric Observability
([#14685](#14685))
([c3273bb](c3273bb))
* **storage:** Read checksums in gRPC partial reads
([#14586](#14586))
([d29f68a](d29f68a))
* **storage:** Support deleteSourceObjects option in object compose
([#14704](#14704))
([0d2d680](0d2d680))
* Update API sources and regenerate
([#14701](#14701))
([a9b7921](a9b7921))


### Bug Fixes

* **storage:** Add server closed idle connection to retriable errors
([#14594](#14594))
([a6bd392](a6bd392))
* **storage:** Fix race condition during retries in gRPC writer
([#14649](#14649))
([c781a75](c781a75))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Krishnam Dhanush <krishnamd@google.com>
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 Cloud Storage API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants