Repository navigation
miso serve/dev: don't stall on idle browser connections - #26
Merged
Merged
Conversation
The server accepted a connection and read it at once, waiting with no timeout. Browsers open connections ahead of time (preconnect) and may send nothing on them for seconds; until the browser sent a request or gave up, the server answered nothing else, and miso dev did not notice changes or rebuild. With one idle connection open, a page did not load within 8 seconds. Accepted connections now wait in the select set with the listener and are read when their request arrives; one silent for 30 seconds is closed. With five idle connections open, 100 parallel requests are answered in 0.4 s. Also: read_file checks ftell, which returns -1 for a file it cannot seek, before allocating its size.
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.
miso devcould stop serving and rebuilding. The server accepted a connection and read from it straight away, with no timeout. Browsers open connections ahead of time (preconnect) and may send nothing on them for seconds. Until the browser sent a request or gave up, the server answered nothing else, andmiso devdidn't notice changes or rebuild.Now accepted connections wait in the
selectset alongside the listener and are read only once their request arrives. A connection that stays silent for 30 seconds is closed.Checked with the built tool (
miso serve):404,
..traversal (plain and%2e%2e), HEAD and POST answer as before.Also:
read_filenow checksftell, which returns -1 for a file it can't seek, before allocating the file's size.Generated by Claude Code