You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e421ac9
Browse filesBrowse the repository at this point in the historyBrowse files
perf(mobile): trim relay call-site stacks and capture them before async waits (#9949)
## Summary
Two follow-ups to the call-site stacks that escaped relay errors carry:
- **Trim:** Sentry parses a whole stack synchronously and has no cap, so
a call-site stack is now cut to its innermost 64 lines (async gap lines
included). When the kept lines hold no `<asynchronous suspension>` line,
one is added after them, so Sentry's stack parser still reads it as a VM
stack directly instead of first scanning it for other formats. The cut
is made when the stack is first formatted, so an error its caller
discards costs no formatting. One `completeErrorAt` helper next to the
error types applies it at every completion site, and query timeouts
throw with the cut stack too.
- **Capture at entry:** `publish`, `fetchHistory` and
`SignedEventRelay.submit` took their call site after the rate-limit
wait, `mayPublish` or `onSigned`. A caller that doesn't await the call
was already gone from the stack by then, so its frame was missing. The
call site is now taken before the first `await`. `submit` re-stacks
relay call errors from `publish` with its own entry stack, since
`publish` only starts after `onSigned`.
### Validation
Added tests: [stack
trimming](https://github.com/block/buzz/blob/tomb/mobile-relay-stack-trim/mobile/test/shared/relay/relay_call_error_test.dart)
(a deep stack is cut to the cap and keeps the frames nearest the call; a
short one is kept whole; a cut stack keeps exactly one async gap
wherever its first gap falls; the stack is formatted only when read, and
only once), and [capture before the
wait](https://github.com/block/buzz/blob/tomb/mobile-relay-stack-trim/mobile/test/shared/relay/relay_session_test.dart)
for a publish and a history request held by the rate limit and a submit
held by `onSigned`, each checking that the caller's frame is on the
completed error's stack.
Full-app check on an iOS simulator signed in to a Builderlab community:
the channel list loads, opening two channels fetches their history, and
a sent message publishes and shows as sent. No relay call errors logged.
---------
Signed-off-by: Tom Brow <tomb@block.xyz>
Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@localhost>
0 commit comments