gaogaotiantian / viztracer

VizTracer is a low-overhead logging/debugging/profiling tool that can trace and visualize your python code execution.
https://viztracer.readthedocs.io/
Apache License 2.0
5.04k stars 377 forks source link

vizviewer fails attempting to open with a large (3.8G) result.json. #308

Open cjw296 opened 1 year ago

cjw296 commented 1 year ago

I created a large result.json with python -m viztracer ..., that run ended up with this message:

Circular buffer is full, you lost some early data, but you still have the most recent data.
    If you need more buffer, use "viztracer --tracer_entries <entry_number>"
    Or, you can try the filter options to filter out some data you don't need
    use --quiet to shut me up

...but a 3.8G result.json was produced, so thought I'd try to visualize it.

vizviewer --server_only result.json looked good, but eventually gave an error from Perfetto after loading 31%: "Oops! Your WASM trace processor ran out of memory"

From the docs, I then tried: vizviewer --server_only --use_external_processor result.json

This ran for much longer before serving up an http port, but failed much more quickly in the browser, this time with:

Viewed on: http://xxx:10000

TypeError: Failed to fetch
TypeError: Failed to fetch
    at http://xxx:10000/v25.0-cca3e0ce7/frontend_bundle.js:113462:9

...but nothing in the logs visible in the console other than:

$ vizviewer  --server_only --use_external_processor result.json
Loading and parsing trace data, this could take a while...

Running vizviewer
You can also view your trace on http://localhost:10000
Press Ctrl+C to quit
gaogaotiantian commented 1 year ago

3.8G is pretty huge, are you using the default entry number? It is expected that WASM can't handle data this large. However, in theory, the external processor should be able to handle it.

I tested locally and it worked with a 150M log. How large is your RAM? How much RAM the processor is using?

gaogaotiantian commented 1 year ago

I double checked the code, and the line that failed should not execute under --use_external_processor. Can you try on a smaller log and see if it works? Also could you confirm that the trace processor process is still running? You can grep trace_processor_shell with ps -aux | grep trace_processor_shell. If the external processor is used properly, the UI on webbrowser should pop up a dialog to ask you if you want to use the external processor.

My guess is your log is so large that the processor ran out of memory and crashed.

Arthur-Null commented 1 year ago

same error here. I had a 4G result.json and ran vizviewer --server_only --use_external_processor result.json on a 1000G RAM server and tried on open the website on my local machine. It gives error message

To assist with debugging please attach or link to the trace you were viewing.

Viewed on: http://localhost:10000

TypeError: Failed to fetch
TypeError: Failed to fetch
    at http://localhost:10000/v25.0-cca3e0ce7/frontend_bundle.js:113462:9

v25.0-cca3e0ce7 cca3e0ce7300e9ab1616888edfd92238fbc27378

The processor process on the server seems to be running normally.

gaogaotiantian commented 1 year ago

@Arthur-Null did you confirm that with a smaller trace file, your method(opening a remote website on local machine) works?

Arthur-Null commented 1 year ago

@Arthur-Null did you confirm that with a smaller trace file, your method(opening a remote website on local machine) works?

Yes, it works on a 10M trace file.

gaogaotiantian commented 1 year ago

Hmm. 4G trace file is indeed huge, but perfetto claimed to be able to handle it. I'm not entirely sure whether this is an issue with perfetto or viztracer. You can probably try to open the trace file with perfetto directly(of course it requires the externel processor as well). I can do the experiment when I have some time(and I need to generate a huge trace file). If standalone Perfetto can handle this file, then I'll invesitigate if viztracer did something wrong.

mbecker8600 commented 7 months ago

FYI, this issue is still happening. has there been any resolution to this?

I have a 3.2G file I'm trying to open and see all the same issues mentioned before.

gaogaotiantian commented 7 months ago

FYI, this issue is still happening. has there been any resolution to this?

I have a 3.2G file I'm trying to open and see all the same issues mentioned before.

Did you use --use_external_processor? Did you try to open the trace file with Perfetto directly instead of vizviewer?

mbecker8600 commented 7 months ago

Owner

Yeah I tried both and I got the same error that the @Arthur-Null had

gaogaotiantian commented 7 months ago

If you can't open the trace file with original Perfetto, then there's nothing viztracer can do. viztracer is using a modified version of Perfetto but the key decoding ability is pure Perfetto. 4G trace is indeed huge and normally I would recommend to use filters to filter out some information, or do a less period of time. However, if you want to make this work, you can submit an issue in Perfetto repo.