Repository navigation
Fix response stream cleanup on client disconnect (#2804) - #2851
Merged
Akanksha Jain (jainakanksha-msft) merged 2 commits intoNov 5, 2026
Merged
Akanksha Jain (jainakanksha-msft) merged 2 commits into
Akanksha Jain (jainakanksha-msft) merged 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The cleanup behavior is consistently implemented and covered by focused cross-service and HTTP regression tests.
0 open findings
What changed in this PR
Fixes leaked extent file descriptors by destroying response bodies when clients disconnect.
Changes:
- Adds cleanup across Blob, Queue, and Table serializers.
- Handles late extent-stream errors after cancellation.
- Adds serializer, persistence, and HTTP regression tests.
-
Impact analysis
- Package: Azurite
- Version change: None
- Usage: Streamed storage responses
- Impact and risk: Prevents
EMFILEfailures; low residual risk.
-
Build and conflict resolution
- Commands run: None
- Issues found: None
- Result: Static review completed.
-
Tests
- Tests added or updated: Serializer, FSExtentStore, and Blob disconnect tests
- Coverage: All serializers plus Loki and SQL Blob paths
- Result: Appropriate regression coverage.
-
Test suite
- Commands run: None
- Passing: Not independently verified
- Pending or failing: CI validation pending.
-
Changelog
- Entry added: Yes
- Location: Upcoming release, General section
-
PR comments
- Threads reviewed: Issue #2804 requirements
- Actions taken: Reviewed all changed files
- Unresolved items: None
-
Self-rating
- Score: 9/10
- Reasoning: Complete static review with focused cross-service and persistence analysis.
-
Iteration
- Improvements made after self-review: Verified middleware lifecycle, response adapters, and test inclusion.
-
Summary
- Why the update matters: Releases file descriptors after aborted downloads.
- Risk if not applied: Repeated disconnects can exhaust file handles.
- Final status: Ready for approval.
| File | Description |
|---|---|
src/blob/generated/utils/serializer.ts |
Cleans up aborted Blob response bodies. |
src/queue/generated/utils/serializer.ts |
Adds equivalent Queue cleanup. |
src/table/generated/utils/serializer.ts |
Adds equivalent Table cleanup. |
src/common/persistence/FSExtentStore.ts |
Handles errors from discarded late streams. |
tests/common/serializer.test.ts |
Tests cancellation across all serializers. |
tests/blob/fsStore.test.ts |
Tests late extent errors after cancellation. |
tests/blob/apis/blob.test.ts |
Tests HTTP client disconnect scenarios. |
ChangeLog.md |
Documents the user-visible fix. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Contributor
Author
@microsoft-github-policy-service agree |
Akanksha Jain (jainakanksha-msft)
approved these changes
Nov 5, 2026
Akanksha Jain (jainakanksha-msft)
merged commit Nov 5, 2026
716539c
into
Azure:main
45 checks passed
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.
First and foremost thank you for the great product. I have been using Azurite for the last three years and it has made local development a breeze.
Why
Ran into HTTP 500 errors after a while when a client performed a large number of HTTP range requests on a single blob.
Following is an excerpt of the log related to the
AggregateError: EMFILE: too many open fileserror:Turned out the issue was already reported in #2804
How to reproduce the error
You can use this docker image (which is based on
azurite:3.37.0) to reproduce the error easily.