Skip to content

fix(gateway): finish static HTTP bodies larger than one chunk - #140

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
agentscritical-bug-identification-4d60
Draft

cursor[bot] wants to merge 1 commit into
mainfrom
agentscritical-bug-identification-4d60

Conversation

@cursor

@cursor cursor Bot commented Nov 1, 2026

Copy link
Copy Markdown

Bug and impact

Opening the dashboard or hardware page never finishes loading JavaScript. GET /js/app.js and GET /js/hardware.js return HTTP 200 with Content-Length 5809 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_WRITEABLE in src/gateway/http_lws.c sends 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_sent reaches static_len, matching the JSON path.

Validation

GATEWAY=1 make test_gateway_http failed before the fix with static /js/app.js incomplete rc=-1 code=200 cl=5809 len=4096. After the fix the same suite passed, including /js/app.js and /js/hardware.js (full gzip body, magic bytes, length equal to Content-Length). A follow-up fetch gunzipped both scripts and found the tail markers hashchange and JETSON_BOARD_ID.

Open in Web View Automation 

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

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant