Skip to content

fix: destroy the read stream on 304 Not Modified - #236

Open
jaideeppyne wants to merge 1 commit into
vercel:mainfrom
jaideeppyne:fix/destroy-stream-on-304
Open

jaideeppyne wants to merge 1 commit into
vercel:mainfrom
jaideeppyne:fix/destroy-stream-on-304

Conversation

@jaideeppyne

Copy link
Copy Markdown

Fixes #235.

Summary

  • Destroy the file read stream before returning 304 Not Modified.
  • Add a regression that createReadStream is destroyed on an If-None-Match hit.

Why

The handler opened the file before evaluating the conditional request. On 304 the stream was never piped, so each cache hit leaked an FD. Under normal browser traffic that is most requests, until EMFILE.

Validation

  • yarn run build-views && yarn test-integration (71 passing)

The handler opened the file before evaluating If-None-Match. On a 304
the stream was never piped or destroyed, so each cache hit leaked an
FD until the process hit EMFILE.

Fixes vercel#235.
@jaideeppyne
jaideeppyne changed the base branch from master to main September 16, 2026 08:25
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.

FD leak on 304 Not Modified: opened read stream is never destroyed (leads to EMFILE)

1 participant