jlfwong / speedscope

🔬 A fast, interactive web-based viewer for performance profiles.
https://www.speedscope.app
MIT License
5.52k stars 241 forks source link

output for speedscope format is not loaded in Firefox in Ubuntu unless it has .json extension #443

Closed undercover87 closed 10 months ago

undercover87 commented 12 months ago

ubuntu 22.04 firefox 116.03

if the output file is arbitrarily named (e.g. profile.speedscope) , Firefox in Ubuntu can't load it. For a "long" period of time it seems as it is loading something, but when the progress bar is completed, we see nothing on the screen. If I add a .json extension in the same file, then firefox in ubuntu renders it just fine and instantly.

The same file (with an arbitrary name) can be loaded succesfully using Chrome in windows (for instance).

This should be documented more explicitly in the docs.

jlfwong commented 12 months ago

Hi @undercover87! Can you please provide a specific test file and open the developer tools console and see if there are errors there?

undercover87 commented 12 months ago

Hello , well I said that is works when I add a json extension and it did work for one of the files, but it did not work on another. This is the console output ` speedscope v1.16.0 speedscope.f27db165.js:187:123 WEBGL_debug_renderer_info is deprecated in Firefox and will be removed. Please use RENDERER. speedscope.f27db165.js:14:8659 WebGL initialized. renderer: llvmpipe, vendor: Mesa/X.org, version: WebGL 1.0 speedscope.f27db165.js:30:1142 Source map error: Error: request failed with status 404 Resource URL: https://www.speedscope.app/speedscope.f27db165.js Source Map URL: speedscope.f27db165.js.map

Source map error: Error: request failed with status 404 Resource URL: https://www.speedscope.app/reset.8c46b7a1.css Source Map URL: reset.8c46b7a1.css.map

Uncaught Error: Expected reader.result to be an instance of ArrayBuffer t https://www.speedscope.app/import.8ae8aa3d.js:42 t https://www.speedscope.app/import.8ae8aa3d.js:42 fromFile https://www.speedscope.app/import.8ae8aa3d.js:42 x https://www.speedscope.app/import.8ae8aa3d.js:121 F https://www.speedscope.app/import.8ae8aa3d.js:121 F https://www.speedscope.app/import.8ae8aa3d.js:121 x https://www.speedscope.app/import.8ae8aa3d.js:121 w https://www.speedscope.app/speedscope.f27db165.js:183 n https://www.speedscope.app/speedscope.f27db165.js:183 promise callbackl https://www.speedscope.app/speedscope.f27db165.js:183 m https://www.speedscope.app/speedscope.f27db165.js:183 m https://www.speedscope.app/speedscope.f27db165.js:183 w https://www.speedscope.app/speedscope.f27db165.js:183 loadFromFile https://www.speedscope.app/speedscope.f27db165.js:183 m https://www.speedscope.app/speedscope.f27db165.js:183 m https://www.speedscope.app/speedscope.f27db165.js:183 loadFromFile https://www.speedscope.app/speedscope.f27db165.js:183 loadProfile https://www.speedscope.app/speedscope.f27db165.js:183 n https://www.speedscope.app/speedscope.f27db165.js:183 promise callbackl https://www.speedscope.app/speedscope.f27db165.js:183 m https://www.speedscope.app/speedscope.f27db165.js:183 m https://www.speedscope.app/speedscope.f27db165.js:183 loadProfile https://www.speedscope.app/speedscope.f27db165.js:183 loadFromFile https://www.speedscope.app/speedscope.f27db165.js:183 onFileSelect https://www.speedscope.app/speedscope.f27db165.js:183 E https://www.speedscope.app/speedscope.f27db165.js:2 import.8ae8aa3d.js:42:3912 t https://www.speedscope.app/import.8ae8aa3d.js:42 (Async: EventListener.handleEvent) t https://www.speedscope.app/import.8ae8aa3d.js:42 fromFile https://www.speedscope.app/import.8ae8aa3d.js:42 x https://www.speedscope.app/import.8ae8aa3d.js:121 next self-hosted:1376 F https://www.speedscope.app/import.8ae8aa3d.js:121 F https://www.speedscope.app/import.8ae8aa3d.js:121 x https://www.speedscope.app/import.8ae8aa3d.js:121 w https://www.speedscope.app/speedscope.f27db165.js:183 next self-hosted:1376 n https://www.speedscope.app/speedscope.f27db165.js:183 (Async: promise callback) l https://www.speedscope.app/speedscope.f27db165.js:183 m https://www.speedscope.app/speedscope.f27db165.js:183 m https://www.speedscope.app/speedscope.f27db165.js:183 w https://www.speedscope.app/speedscope.f27db165.js:183 loadFromFile https://www.speedscope.app/speedscope.f27db165.js:183 next self-hosted:1376 m https://www.speedscope.app/speedscope.f27db165.js:183 m https://www.speedscope.app/speedscope.f27db165.js:183 loadFromFile https://www.speedscope.app/speedscope.f27db165.js:183 loadProfile https://www.speedscope.app/speedscope.f27db165.js:183 next self-hosted:1376 n https://www.speedscope.app/speedscope.f27db165.js:183 (Async: promise callback) l https://www.speedscope.app/speedscope.f27db165.js:183 m https://www.speedscope.app/speedscope.f27db165.js:183 m https://www.speedscope.app/speedscope.f27db165.js:183 loadProfile https://www.speedscope.app/speedscope.f27db165.js:183 loadFromFile https://www.speedscope.app/speedscope.f27db165.js:183 onFileSelect https://www.speedscope.app/speedscope.f27db165.js:183 E https://www.speedscope.app/speedscope.f27db165.js:2 Source map error: Error: request failed with status 404 Resource URL: https://www.speedscope.app/import.8ae8aa3d.js Source Map URL: import.8ae8aa3d.js.map `

jlfwong commented 12 months ago

Thanks for providing the stack trace! That's helpful, but still very difficult to debug without an actual test file that failed import.

Can you please upload the profile that's failing to import?

The other thing that would be helpful to know is where the file came from. Was it an export from speedscope itself, or did it come from another tool that was output in speedscope format?

undercover87 commented 11 months ago

Hello, unfortunately I can't provide the whole profile file, could you maybe me point me to a specific portion of the profile file you'd like to see based on the stack output? The output file came from pyspy.

jlfwong commented 11 months ago

Realistically, I won't be able to investigate the problem unless I can reproduce it myself. If you can produce another file using pyspy on a codebase other than yours which contains none of the proprietary information, I should be able to investigate

KerekesDavid commented 10 months ago

I just ran into the same problem, and I manage to reproduce it.

The file I was reading was created by running the debugger with sudo, and therefore the file is inacessible to the browser. Trying to import it under both Firefox and Chrome just makes speedscope hang. Changing file permissions so the file is readable fixes the problem. (Which is why renaming or moving the file to Windows solved the issue for OP)

Reproduction steps:

  1. example.json
  2. sudo chown root example.json
  3. Speedscope in Firefox hangs with the above error.
jlfwong commented 10 months ago

@undercover87 Can you check file permissions for your reproduction case and see if that's the issue? Asking because that would suggest a different problem than described in the OP description

undercover87 commented 10 months ago

Thanks @KerekesDavid , it was an access rights issue indeed, the file that wouldn't load had root:root.. Chown-ing it to my user account as owner and group solved the issue!

KerekesDavid commented 10 months ago

Not sure if you should close this issue, I imagine a lot of people will run into this problem. If possible, it might be prudent to give the user a useful error message instead of hanging. @jlfwong

jlfwong commented 10 months ago

@KerekesDavid If there's a way to detect this specific problem (by e.g. catching the error and warning that it may be caused by this then re-throwing), I'd accept a PR to address that!

KerekesDavid commented 10 months ago

No idea sadly, I'm not well acquainted with browser side stuff. I was just thinking marking this issue as closed might make people think the problem was solved, when it is not, the bug still exists (from a user perspective).

undercover87 commented 10 months ago

I can take a look and let you know if I can handle it.