Skip to content

Conversation

@hoxyq
Copy link

@hoxyq hoxyq commented Oct 27, 2025

Summary

This updates the frontend to use the args.data.rnStackTrace field of the trace event for displaying stack traces that were explicitly specified by the trace event engine.

Q: Why can't we use built-in Chromium's definitions?

From my understanding, whenever there is a console.timeStamp or performance.measure call, Chromium asks V8 to take a sample and it receives an id in exchange. Then, this id is used for tagging samples, user timing events, and async stack tagging entries (via console.createTask). In the end, the frontend will connect all these things together at the trace processing stage and will form a stack trace.

Hermes doesn't have proper async stack traces, it also doesn't support sub-sampling at the moment, so there are no stable identifiers that we could use to match samples with stack traces.

There is an advantage to this approach. If you look at CDT's code, for some reason it's default behaviour is to try to guess the stack trace by looking at the sample. For Components track, this ofter points to the component definition, not the JSX declaration that we were trying point to by using console.createTask for every unique JSX call.

With this approach, we will actually show the correct JSX location of where the currently selected entry on a Components track was rendered in its owner, which is far more useful. You can easily grep the component implementation by its name, but it is not obvious to find where this component was rendered.

The only significant drawback is that this is yet another divergence from Web, basically if you upload RN's trace to the browser, you won't see stack traces. This is also fine, because even if we had a parity with browser, these traces won't get symbolicated.

Test plan

  • This change maintains backwards compatibility with previous Local Storage data (if modifying settings, experiments, or other persisted client state).

Upstreaming plan

@hoxyq hoxyq merged commit 96e6bb8 into main Oct 27, 2025
5 checks passed
@hoxyq hoxyq deleted the task-stack-traces branch October 27, 2025 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants