fix(transport): track cumulative inflight keepalive bytes and count#1165
Open
overbalance wants to merge 2 commits intomainfrom
Open
fix(transport): track cumulative inflight keepalive bytes and count#1165overbalance wants to merge 2 commits intomainfrom
overbalance wants to merge 2 commits intomainfrom
Conversation
Contributor
Chrome DevTools Protocol Tracing (Script: 118.50ms, Heap: 12.67MB)
Lighthouse (Script Eval: 55.26ms)
Platform Tests (vite-7 es2015 gzip: 66.58KB)vite-6 Platform Tests
vite-7 Platform Tests
webpack-5 Platform Tests
|
30380c4 to
c1c4b61
Compare
ac49faf to
04bb420
Compare
a2ec740 to
7a70988
Compare
| inflightKeepaliveBytes += request.byteLength; | ||
| inflightKeepaliveCount++; | ||
| } else { | ||
| diag.warn( |
Contributor
There was a problem hiding this comment.
At this point we're at risk of not sending the request if the tab closes before it's out right? Should we store something in localStorage and send some flag on the next session so we can start having some metrics on how often this happens?
Contributor
Author
There was a problem hiding this comment.
Great idea. I'll have to test it. I think you're out of time if we try on page exit if you are queuing a request and also then attempting a synchronous write to localStorage.
packages/web-sdk/src/transport/FetchTransport/FetchTransport.ts
Outdated
Show resolved
Hide resolved
9cf9532 to
4d2c64b
Compare
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.
What problem is this solving?
The fetch spec's 64KiB keepalive limit is cumulative across all inflight keepalive requests per fetch group, not per-request. Two concurrent 30KiB requests exceed the real 64KiB limit while both passing a per-request check. Chrome also enforces a 9-request concurrent keepalive limit per renderer process. Exceeding either limit fails with an opaque TypeError indistinguishable from a network error, silently losing data.
Short description of changes
keepalive: truewhen the request fits within a conservative 48KiB cumulative budget and the concurrent count is under 9send()calls; adjust to actual compressed size after compression completesfinallyblock so budget is freed on both success and failurediag.warnwhen keepalive is downgraded, including which limit was hitdiag.warnon fetch failure anddiag.debugon HTTP error responsesNote on compression error handling
Compression now runs inside the
tryblock, so compression failures return{ status: 'failure' }instead of propagating as uncaught errors. This is intentional: it makes compression failures consistent with other transport errors and prevents unhandled promise rejections.Testing
npm run testnpm run validate