Repository navigation
Root-cause forwarded-port truncation in Dev Containers (investigation only, no repo changes) - #11942
Draft
Alex Ross (alexr00) with Copilot wants to merge 1 commit into
Draft
Alex Ross (alexr00) with Copilot wants to merge 1 commit into
Alex Ross (alexr00) with Copilot wants to merge 1 commit into
Conversation
Copilot
AI
changed the title
[WIP] Fix net::ERR_CONTENT_LENGTH_MISMATCH on port-forwarding
Root-cause forwarded-port truncation in Dev Containers (investigation only, no repo changes)
Nov 5, 2026
This branch has not been deployed
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.
Responses sent through a Dev Containers forwarded port are cut short under load. Browsers report
ERR_CONTENT_LENGTH_MISMATCHand curl exits with code 18. The bug still reproduces on VS Code 1.145, which already includes microsoft/vscode#338875.This PR has no file changes. This repo has no port-forwarding code; the fix belongs in the closed-source Dev Containers extension.
Root cause
docker exec -i <container> node -e <relay>(relay script quoted in DevContainer Port Forwarding terminates prematurely #11707).process.exit()immediately. Any response bytes still queued onprocess.stdoutare lost. Underdocker exec -i, stdout is a pipe (FIFO), and Node writes to pipes asynchronously on POSIX.Local reproduction using the extension's per-connection
docker execapproach and the exact relay from #11707. Load was 1 MB responses, 40 parallel requests × 3 runs × 4 rounds (480 requests):process.exiton close)Proposed fix (Dev Containers extension)
This is a condensed form of the #11707 patch; that original form is the one that produced the 480/480 result above.
Secondary findings
client.end()instead. This change is untested, and browsers and curl don't close their sending side this way, so it isn't behind this issue.destroy()on close produces the same symptom. That matches what_mirrorGenericSocketin VS Code did before #338875. The cutoff is a fixed amount of data (~2.7 MB at both 300 KB/s and 150 KB/s), not a timer. #338875 likely fixed this, but I haven't confirmed that Dev Containers goes through that code path.Open questions