LibWeb: Release discarded navigation redirect requests#10724
Merged
awesomekling merged 1 commit intoJul 17, 2026
Conversation
Since f454515, document navigation requests have been retained in RequestServer so they can be handed to the UI process if a response becomes a download. Intermediate redirect responses never reach download handling, however, and replacing FetchController's pending request left each retained response pipe open. Repeated redirects eventually exhausted RequestServer's file descriptors. The Fetch specification does not account for this lifecycle. RequestServer transfer retention is a Ladybird implementation detail, not web-observable Fetch state. Release the transfer hold before discarding an intermediate redirect response, and stop its request when it is still active. Cover this with a focused http_redirect_fetch() test that records the release of a synthetic intermediate response. An end-to-end regression would have to lower the process file limit and perform hundreds of navigations, making it slow and dependent on test-runner arguments and process timing. The unit test directly protects the missing ownership step.
📝 WalkthroughWalkthroughHTTP redirect fetching now releases intermediate response transfer state and stops associated requests when no location URL is produced. The fetch function is exported, and a LibWeb test verifies transfer release during redirect processing. ChangesRedirect cleanup
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
Comment |
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.
Since f454515, document navigation requests have been retained in RequestServer so they can be handed to the UI process if a response becomes a download. Intermediate redirect responses never reach download handling, however, and replacing FetchController's pending request left each retained response pipe open. Repeated redirects eventually exhausted RequestServer's file descriptors.
The Fetch specification does not account for this lifecycle. RequestServer transfer retention is a Ladybird implementation detail, not web-observable Fetch state. Release the transfer hold before discarding an intermediate redirect response, and stop its request when it is still active.
Cover this with a focused http_redirect_fetch() test that records the release of a synthetic intermediate response. An end-to-end regression would have to lower the process file limit and perform hundreds of navigations, making it slow and dependent on test-runner arguments and process timing. The unit test directly protects the missing ownership step.
This is one of the potential sources for FD leaks that we're seeing on our WPT runner.