Skip to content

fix(storage): destroy local read stream on upload write failure to prevent resource leaks - #25

Open
thiyaguk09 wants to merge 7 commits into
mainfrom
fix/7325-upload-fd-leak
Open

fix(storage): destroy local read stream on upload write failure to prevent resource leaks#25
thiyaguk09 wants to merge 7 commits into
mainfrom
fix/7325-upload-fd-leak

Conversation

@thiyaguk09

Copy link
Copy Markdown
Owner

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #<issue_number_goes_here> 🦕

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

Copy link
Copy Markdown

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 bucket upload logic to ensure that the local read stream is explicitly destroyed if a read or write error occurs, and adds a corresponding unit test to verify this behavior. The review feedback suggests destroying the writable stream on read errors to prevent resource leaks, asserting that the read stream is defined in the test before checking its destroyed state, and resetting the mock override in an afterEach hook to avoid test pollution.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread handwritten/storage/src/bucket.ts
Comment thread handwritten/storage/test/bucket.ts
Comment thread handwritten/storage/test/bucket.ts
@thiyaguk09
thiyaguk09 force-pushed the fix/7325-upload-fd-leak branch 2 times, most recently from 8f04997 to 05aba49 Compare July 10, 2026 12:30
@thiyaguk09
thiyaguk09 force-pushed the fix/7325-upload-fd-leak branch 5 times, most recently from 0065855 to 292550e Compare July 27, 2026 06:48
@thiyaguk09
thiyaguk09 force-pushed the fix/7325-upload-fd-leak branch 4 times, most recently from b9dfc50 to a87843b Compare July 30, 2026 04:48
westarle and others added 7 commits July 30, 2026 13:28
…pis#9028)

Update pinned action version comments to match exact SemVer tags (e.g.,
# v6.0.3, # v4.3.1, # v6.4.0) to satisfy online zizmor scanner.
…typescript (googleapis#9029)

## Description

Upgrade the gapic-generator-typescript to node version 22. 

## Impact

Ensures users upgrade their runtime to Node 22 and don't encounter
problems due to legacy Node 18 issues.

## Changes

Node was upgraded to version 22 in two package.json files and then `npm
run baseline` was run.

Just the following files were updated:

core/generator/gapic-generator-typescript/templates/cjs/typescript_gapic/package.json

core/generator/gapic-generator-typescript/templates/esm/typescript_gapic/package.json

Then in core/generator/gapic-generator-typescript we ran the following
command:
`npm run baseline`


## Next steps

Next we are going to upgrade all the packages in the root `packages`
directory to separate concerns about the packages and the
gapic-typescript-generator.
@thiyaguk09
thiyaguk09 force-pushed the fix/7325-upload-fd-leak branch from a87843b to 55d0225 Compare July 31, 2026 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants