-
Notifications
You must be signed in to change notification settings - Fork 451
Move symbol table demangling out of SymbolStore into SymbolProvider #5746
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
Conversation
a1e4db0 to
568be0a
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5746 +/- ##
==========================================
+ Coverage 85.64% 85.67% +0.02%
==========================================
Files 313 314 +1
Lines 31013 31106 +93
Branches 8535 8558 +23
==========================================
+ Hits 26562 26649 +87
- Misses 4021 4027 +6
Partials 430 430 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
568be0a to
a66fd2c
Compare
canova
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thanks!
| // Note, the database name still references the old project name, "perf.html". It was | ||
| // left the same as to not invalidate user's information. | ||
| const symbolProvider = new RegularSymbolProvider( | ||
| 'perf-html-async-storage', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I was looking at the previous commits and was going to suggest moving the name here, but looks like you already did it :)
src/actions/receive-profile.ts
Outdated
| if (typeof dbNamePrefixOrDB === 'string') { | ||
| this._symbolDb = new SymbolStoreDB(`${dbNamePrefixOrDB}-symbol-tables`); | ||
| } else { | ||
| this._symbolDb = dbNamePrefixOrDB; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we ever use this path where we pass a ISymbolStoreDB (or intend to use in the future)? I can't find any use cases for it. So maybe we can convert dbNamePrefixOrDB to a string only and simplify this logic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, no, we are definitely not intending to use this in the future. I'll add a commit to make it a string.
src/actions/receive-profile.ts
Outdated
| async closeDb() { | ||
| await this._symbolDb.close(); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't find any calls to closeDb. Is this expected? Where do we close the DB or do we keep it open all the time?
Hmm, looking at the old code, I can't find any callers to it either. So it's not new at least.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, this was used by tests, but I removed all those tests. Our tests don't really exercise the caching logic any more because I moved it into the RegularSymbolProvider which isn't used in the tests. I'll remove closeDb as well then.
…k cached symbol tables only after API requests come back with no info.
…ses to the SymbolStore it creates.
…'t in the database.
This removes the demangling dependency from symbol-store.ts. It also lets us remove the unused "database" from symbolicator-cli. The cache only exists so that we don't give the browser unnecessary work to recompute the symbol table. So we only need to access the cache if we're about to ask the browser for a full symbol table.
a66fd2c to
3f43d12
Compare
With this and #5746 combined, `yarn build-symbolicator-cli` will only produce a single output file. Without this PR, it also produced two SVG files.
We have a WASM module for symbol demangling. However, usually we don't actually make any use of it: Usually, we get symbols via the symbolication API, either from the server or from the browser. And in the JSON API response, the symbols are already demangled.
The only time when we need to do the demangling in the front-end is if we fail to get symbols via the API and instead get a full symbol table from the browser. This is a rare case. With modern versions of Firefox (anything newer than Firefox 95), we only hit this case if we capture a profile from Firefox for Android (via about:debugging) and get symbols for native Android libraries. (There's one other case: Sometimes the symbolication API query runs out of memory when you have a local Firefox build with a big symbol table, so then the browser symbolication API fails but getting the symbol table succeeds.)
This PR is an attempt to make it so that we only load the demangling module when we run the symbolication code in a browser context.
Today, symbolicator-cli bundles the unused demangling wasm module. This PR moves the wasm dependency into receive-profile.ts which isn't used by symbolicator-cli, so the symbolicator-cli build will no longer bundle it.
Before:
After: