patches: carry upstream PR 68 instead of our narrower fix #106
No reviewers
Labels
No labels
area:defold
area:docs
area:infra
area:protocol
area:testing
kind:bug
kind:chore
phase:breadth
phase:core
phase:hardening
phase:slice
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
yuris/spacetimedb-defold!106
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "adopt-upstream-patch"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
patches/extension-websocket-html5-subprotocol.patchnow carries upstream PR #68 verbatim instead of our narrower fix. The diff body is byte-identical to68.diff; only the prose header is ours.Why theirs is better
Same root cause. 4.2.3 starts the platform connection inside
CreateConnection(), which runs beforeLuaConnect()assignsm_ConnectTimeout,m_CustomHeaders,m_Protocolandm_Callback, andconnwas memset to zero. #68 moves both platform starts intoStartConnection()and calls it at the end ofLuaConnect, once every field is set and the connection is registered. Ours moved only the emscripten call, and only as far as the two strdups it needed — so it still started the socket beforem_Callbackexisted.Ours left the native half in place.
CreateConnectionWslayspawnsConnectionWorkerimmediately, and that thread readsm_ConnectTimeoutviaCheckConnectTimeout(t >= conn->m_ConnectTimeout, true for anytwhile the field is 0) before it ever reachesm_Protocolinhandshake.cpp. Two strdups beat a TCP connect essentially always, which is why this was invisible.Made it visible by injecting a 300 ms sleep after
CreateConnection()and building three headless x86_64-linux bundles against a live server:PHASE1 OKPHASE1 OKA TCP tee in front of the port confirms the failing build sends no handshake at all — it dies on the timeout check before it could offer a subprotocol.
Our old patch header said "Native builds are unaffected: wslay writes the handshake later, from the update loop." It writes it later from a thread, which is not the same guarantee. That claim had also reached
Installation.md; both are corrected here, and the wiki now points at #68.Verification
HTML5 conformance with the new patch in place, both wires:
Seven phases each, across a server restart and a page reload.
patch -p1applies clean to 4.2.3.Adopting it before it merges means the harness tests the code upstream will actually release. When a release carries it, this file, the apply step in
html5-conformance.shand the remote-dependency instruction in the install docs all go together — that teardown is written into the patch header.