Skip to content

feat(node): Collect Local Variables via a worker #11586

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 16, 2024

Conversation

timfish
Copy link
Collaborator

@timfish timfish commented Apr 13, 2024

Our Local Variables integration is limited by the fact that it executes debugger commands from the main app thread. This means that no async work can be completed while the debugger is paused and local variables are being collected. This in turn means that all the synchronous work needs to be queued which risks stack overflows. For this reason we've limited local variable collection to the 5 frames closest to the top of the stack.

When debugging from a worker thread, there are no such limitations around performing async work during debugger pause.

This PR adds a worker thread which is tasked with collecting local variables when the debugger pauses. It passes these back to the main thread via IPC which are then later added to event stack frames.

Possible Improvements

It's possible to combine both ANR and Local Variables into a single worker thread.

Copy link
Contributor

github-actions bot commented Apr 13, 2024

size-limit report 📦

Path Size
@sentry/browser 22.17 KB (0%)
@sentry/browser (incl. Tracing) 31.75 KB (0%)
@sentry/browser (incl. Tracing, Replay) 67.07 KB (0%)
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 60.47 KB (0%)
@sentry/browser (incl. Tracing, Replay with Canvas) 70.91 KB (0%)
@sentry/browser (incl. Tracing, Replay, Feedback) 80.8 KB (0%)
@sentry/browser (incl. Feedback) 35.73 KB (0%)
@sentry/browser (incl. Feedback, Feedback Modal) 35.73 KB (0%)
@sentry/browser (incl. Feedback, Feedback Modal, Feedback Screenshot) 37.75 KB (0%)
@sentry/browser (incl. sendFeedback) 26.97 KB (0%)
@sentry/react 24.85 KB (0%)
@sentry/react (incl. Tracing) 34.65 KB (0%)
@sentry/vue 25.74 KB (0%)
@sentry/vue (incl. Tracing) 33.46 KB (0%)
@sentry/svelte 22.3 KB (0%)
CDN Bundle 24.29 KB (0%)
CDN Bundle (incl. Tracing) 32.77 KB (0%)
CDN Bundle (incl. Tracing, Replay) 66.42 KB (0%)
CDN Bundle (incl. Tracing, Replay, Feedback) 82.58 KB (0%)
CDN Bundle - uncompressed 72.37 KB (0%)
CDN Bundle (incl. Tracing) - uncompressed 98.36 KB (0%)
CDN Bundle (incl. Tracing, Replay) - uncompressed 208.02 KB (0%)
@sentry/nextjs (client) 34.01 KB (0%)
@sentry/sveltekit (client) 32.25 KB (0%)
@sentry/node 124.81 KB (+3.73% 🔺)

@timfish timfish marked this pull request as ready for review April 15, 2024 11:04
@AbhiPrasad AbhiPrasad merged commit 1a22856 into develop Apr 16, 2024
78 checks passed
@AbhiPrasad AbhiPrasad deleted the timfish/local-variables-worker branch April 16, 2024 13:49
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.

2 participants