Repository navigation
fix(gateway): finish static HTTP bodies larger than one chunk - #140
Draft
cursor[bot] wants to merge 1 commit into
Draft
cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
The HTTP writable callback sent at most 4096 bytes and did not ask libwebsockets for another write. Dashboard and hardware JavaScript gzip past that cap, so the browser waited on Content-Length and the UI never started. Co-authored-by: esadrianno <esadrianno@gmail.com>
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.
Bug and impact
Opening the dashboard or hardware page never finishes loading JavaScript.
GET /js/app.jsandGET /js/hardware.jsreturn HTTP 200 withContent-Length5809 and 4546, then send only the first 4096 bytes and leave the connection open. The browser waits on the rest of the gzip body, so the UI never starts.Root cause
LWS_CALLBACK_HTTP_WRITEABLEinsrc/gateway/http_lws.csends at most 4096 body bytes per call. The JSON response path asks libwebsockets for another writable callback while bytes remain. The static-file path did not, so any embedded asset larger than one chunk stalled after the first write.Fix
Request another writable callback until
static_sentreachesstatic_len, matching the JSON path.Validation
GATEWAY=1 make test_gateway_httpfailed before the fix withstatic /js/app.js incomplete rc=-1 code=200 cl=5809 len=4096. After the fix the same suite passed, including/js/app.jsand/js/hardware.js(full gzip body, magic bytes, length equal toContent-Length). A follow-up fetch gunzipped both scripts and found the tail markershashchangeandJETSON_BOARD_ID.