Skip to content
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

An error occurred in Firefox Profiler while analysing a profile #5290

Open
mayankleoboy opened this issue Jan 5, 2025 · 7 comments
Open
Labels
bug Very important to fix, typically this means that the tool is broken or lying help wanted Things ready to be worked on by anyone. Issues must include instructions on how to complete the task profile data Issues related to the profile format, data structure, or profile upgraders timeline Issues related to the header timeline view

Comments

@mayankleoboy
Copy link

mayankleoboy commented Jan 5, 2025

I had profiled https://battle.modez.pro/ , and was looking at the profile.
Suddenly got this error:

Uh oh, some unknown error happened in profiler.firefox.com.

Error: Expected an item to exist, and it was undefined..

Please report this issue to the developers, including the full error as displayed in the Developer Tools’ Web Console.

Error in console:
10:14:49.724 injected firefox content.js:142:11
10:14:49.858 Successfully compiled asm.js code (total compilation time 27ms) zee-worker.js
10:15:07.345
Error: Expected an item to exist, and it was undefined.
h flow.js:182
render SampleTooltipContents.js:136
React 10
react-dom.production.min.js:188:119
React 11
10:15:07.345
An unhandled error was thrown in a React component. Error: Expected an item to exist, and it was undefined.
h flow.js:182
render SampleTooltipContents.js:136
React 10

Gk@https://profiler.firefox.com/main.1cb3af3791ee766fff86.bundle.js:133:53375
div
Kb@https://profiler.firefox.com/main.1cb3af3791ee766fff86.bundle.js:114:44368
div
Hk@https://profiler.firefox.com/main.1cb3af3791ee766fff86.bundle.js:133:54068
@https://profiler.firefox.com/main.1cb3af3791ee766fff86.bundle.js:117:15904
div
Ax@https://profiler.firefox.com/main.1cb3af3791ee766fff86.bundle.js:137:281
@https://profiler.firefox.com/main.1cb3af3791ee766fff86.bundle.js:117:15904
c@https://profiler.firefox.com/main.1cb3af3791ee766fff86.bundle.js:2:24380
div
div
li
PS@https://profiler.firefox.com/main.1cb3af3791ee766fff86.bundle.js:137:70940
c@https://profiler.firefox.com/main.1cb3af3791ee766fff86.bundle.js:2:24380
ol
KS@https://profiler.firefox.com/main.1cb3af3791ee766fff86.bundle.js:137:78856
li
YS@https://profiler.firefox.com/main.1cb3af3791ee766fff86.bundle.js:137:81848
c@https://profiler.firefox.com/main.1cb3af3791ee766fff86.bundle.js:2:24380
ol
KS@https://profiler.firefox.com/main.1cb3af3791ee766fff86.bundle.js:137:78856
div
div
div
lB@https://profiler.firefox.com/main.1cb3af3791ee766fff86.bundle.js:137:94960
div
oB@https://profiler.firefox.com/main.1cb3af3791ee766fff86.bundle.js:137:89197
c@https://profiler.firefox.com/main.1cb3af3791ee766fff86.bundle.js:2:24380
vB@https://profiler.firefox.com/main.1cb3af3791ee766fff86.bundle.js:137:113962
@https://profiler.firefox.com/main.1cb3af3791ee766fff86.bundle.js:117:15904
c@https://profiler.firefox.com/main.1cb3af3791ee766fff86.bundle.js:2:24380
LB@https://profiler.firefox.com/main.1cb3af3791ee766fff86.bundle.js:137:123460
c@https://profiler.firefox.com/main.1cb3af3791ee766fff86.bundle.js:2:24380
div
s@https://profiler.firefox.com/main.1cb3af3791ee766fff86.bundle.js:200:573772
div
t@https://profiler.firefox.com/main.1cb3af3791ee766fff86.bundle.js:200:575421
div
div
tk@https://profiler.firefox.com/main.1cb3af3791ee766fff86.bundle.js:133:27292
YB@https://profiler.firefox.com/main.1cb3af3791ee766fff86.bundle.js:137:126842
c@https://profiler.firefox.com/main.1cb3af3791ee766fff86.bundle.js:2:24380
UI@https://profiler.firefox.com/main.1cb3af3791ee766fff86.bundle.js:137:158880
c@https://profiler.firefox.com/main.1cb3af3791ee766fff86.bundle.js:2:24380
jm@https://profiler.firefox.com/main.1cb3af3791ee766fff86.bundle.js:111:3131
c@https://profiler.firefox.com/main.1cb3af3791ee766fff86.bundle.js:2:24380
div
QB@https://profiler.firefox.com/main.1cb3af3791ee766fff86.bundle.js:137:128910
c@https://profiler.firefox.com/main.1cb3af3791ee766fff86.bundle.js:2:24380
cg@https://profiler.firefox.com/main.1cb3af3791ee766fff86.bundle.js:111:19405
ug
de@https://profiler.firefox.com/main.1cb3af3791ee766fff86.bundle.js:2:17306
ce@https://profiler.firefox.com/main.1cb3af3791ee766fff86.bundle.js:2:17219
g_@https://profiler.firefox.com/main.1cb3af3791ee766fff86.bundle.js:137:179088
c@https://profiler.firefox.com/main.1cb3af3791ee766fff86.bundle.js:2:24380
st@https://profiler.firefox.com/main.1cb3af3791ee766fff86.bundle.js:2:22644
cg@https://profiler.firefox.com/main.1cb3af3791ee766fff86.bundle.js:111:19405
dg
v_@https://profiler.firefox.com/main.1cb3af3791ee766fff86.bundle.js:137:180180 ErrorBoundary.js:43:12
10:15:21.681
Unknown property ‘-moz-user-focus’. Declaration dropped. from-browser:1:604
10:15:21.684
Unknown property ‘-moz-user-focus’. Declaration dropped. from-browser:1:1497
10:15:21.684
Unknown property ‘-moz-user-focus’. Declaration dropped. from-browser:1:349
10:15:21.685
Unknown property ‘-moz-user-focus’. Declaration dropped.

┆Issue is synchronized with this Jira Task

@julienw julienw added bug Very important to fix, typically this means that the tool is broken or lying profile data Issues related to the profile format, data structure, or profile upgraders timeline Issues related to the header timeline view labels Jan 6, 2025
@julienw
Copy link
Contributor

julienw commented Jan 6, 2025

This happens at

if (hasSamples) {
const stack = getFuncNamesAndOriginsForPath(
convertStackToCallNodeAndCategoryPath(
rangeFilteredThread,
ensureExists(stackIndex)
),
rangeFilteredThread
);

It would be good to check for the existence of the stackIndex in the if condition instead of using ensureExists.

@julienw julienw added the help wanted Things ready to be worked on by anyone. Issues must include instructions on how to complete the task label Jan 6, 2025
@theoniko
Copy link
Contributor

theoniko commented Feb 4, 2025

Hello,
Could you please give a hint how to reproduce it locally?
For example load a profile from file or from URL and which action in https://battle.modez.pro/ can cause it?

@julienw
Copy link
Contributor

julienw commented Feb 4, 2025

Honestly I'm not sure when this case might happen. It's rare enough that we might want to have a warning for this case, so that if we see it in the wild at least we don't crash and somebody would be able to upload the profile still.

@theoniko
Copy link
Contributor

theoniko commented Feb 6, 2025

No problem, I thought maybe @mayankleoboy had and could attach the profile file that caused the exception so as to have a way reproduce it.

I create a draft which probably avoid this exception #5353.

@theoniko
Copy link
Contributor

theoniko commented Feb 6, 2025

@julienw
btw I was trying to debug SampleTooltipContents.test.js locally with visual studio code based on launch.json in windows OS
unsuccessfully. Do you have a hint why my breaking points like in testcase it('renders the CPU usage properly for the first part of the sample',..) was not hit? I would be grateful if you could give some feedback.

Debugger attached. yarn run v1.22.22 $ node bin/output-fixing-commands.js cross-env LC_ALL=C TZ=UTC NODE_ENV=test jest .\node_modules\jest\bin\jest --runInBand C:\Users\nikol\Desktop\mozilla\profiler\src\test\components\SampleTooltipContents.test.js Debugger attached. 💡 You might be able to fix the error by running yarn test -u Waiting for the debugger to disconnect... Done in 0.89s. Waiting for the debugger to disconnect...

@canova
Copy link
Member

canova commented Feb 6, 2025

Actually I was looking at a profile and managed to reproduce it, and this is easier to reproduce after #5298. This is happening when the stack is filtered though a transform when we already have a tooltip hovered in the activity graph. Here's an example:

STR:

Image

Click any of those squares.

  • Do not move your mouse after clicking, and press the "d" key.

This will apply the "drop samples" transform and it will remove them from the view.

Expected behavior: it should not crash
Current behavior: it crashes

So it's more likely because applying a transform removes the "stack" value of the sample. This is mostly due to the reason we get the filtered thread here. We should ideally do not render this popup when there is no stack.

You can test it locally by converting the profiler.firefox.com url to http://localhost:4242.

@julienw
Copy link
Contributor

julienw commented Feb 7, 2025

@julienw btw I was trying to debug SampleTooltipContents.test.js locally with visual studio code based on launch.json in windows OS unsuccessfully. Do you have a hint why my breaking points like in testcase it('renders the CPU usage properly for the first part of the sample',..) was not hit? I would be grateful if you could give some feedback.

Debugger attached. yarn run v1.22.22 $ node bin/output-fixing-commands.js cross-env LC_ALL=C TZ=UTC NODE_ENV=test jest .\node_modules\jest\bin\jest --runInBand C:\Users\nikol\Desktop\mozilla\profiler\src\test\components\SampleTooltipContents.test.js Debugger attached. 💡 You might be able to fix the error by running yarn test -u Waiting for the debugger to disconnect... Done in 0.89s. Waiting for the debugger to disconnect...

usually I use the word "debugger;" explicitely in the code so that I'm sure it will break ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Very important to fix, typically this means that the tool is broken or lying help wanted Things ready to be worked on by anyone. Issues must include instructions on how to complete the task profile data Issues related to the profile format, data structure, or profile upgraders timeline Issues related to the header timeline view
Projects
None yet
Development

No branches or pull requests

4 participants