facebookarchive / memory-analyzer

A memory analyzer for running python processes
MIT License
154 stars 14 forks source link

Objgraph images not saved #22

Closed Riksou closed 3 years ago

Riksou commented 3 years ago

Hello, while using memory_analyzer I found out that the images from objgraph were not being saved even though the path of them is being shown in the summary of the analyse. I’ve searched everywhere and couldn’t find any of the images. Any idea on why this happens?

Thanks.

thatch commented 3 years ago

Can you provide a little more info about your environment and how you're running it, including some logs of running memory-analyzer? If there's a chroot, container, etc involved, are you looking in target's filesystem?

thatch commented 3 years ago

Also: This might be related to #18, what version are you running?

Riksou commented 3 years ago

I’m running the latest version directly pip installed from GitHub. I run the tool directly in a virtual-environment with python 3.8, I’m also using Ubuntu 18.04. The target process is not located in any container, it is just running using another virtual environment.

memory_analyzer run -s 2 --no-upload --debug --quiet 1847903
Analyzing pid 1847903
Setting up GDB for pid 1847903
/home/tests/tests-env/bin/python3.8-dbg: No such file or directory.
[New LWP 1847905]
[New LWP 1847910]
[New LWP 1847911]
[New LWP 1847913]
[New LWP 1847914]
[New LWP 1929080]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
0x00007fbff1ebe5ce in epoll_wait () from /lib/x86_64-linux-gnu/libc.so.6
+set directories /home/tests/tests-env/lib/python3.8/site-packages/memory_analyzer/
+py sys.path.append("/home/tests/tests-env/lib/python3.8/site-packages/memory_analyzer/")
++file_command /tmp/tmppia4vfp4/rendered_template-1847903.py.out
GIL $1
+++call (void) PyRun_SimpleString("with open('/tmp/tmppia4vfp4/rendered_template-1847903.py.out') as f: exec(f.read())")
+++call (void) PyGILState_Release($1)
[Inferior 1 (process 1847903) detached]
Gathering data...
Writing output to file memory_analyzer_out/memory_analyzer_snapshot-20210322174120

The only thing which looks suspicious is the fourth line, but if I run the following the message disappear but the images are still not saved.

memory_analyzer run -s 2 --no-upload --debug --quiet 1847903 -e /usr/bin/python3.8
Analyzing pid 1847903
Setting up GDB for pid 1847903
[New LWP 1847905]
[New LWP 1847910]
[New LWP 1847911]
[New LWP 1847913]
[New LWP 1847914]
[New LWP 1929080]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
0x00007fbff1ebe5ce in epoll_wait () from /lib/x86_64-linux-gnu/libc.so.6
+set directories /home/tests/tests-env/lib/python3.8/site-packages/memory_analyzer/
+py sys.path.append("/home/tests/tests-env/lib/python3.8/site-packages/memory_analyzer/")
++file_command /tmp/tmp8sav8i6l/rendered_template-1847903.py.out
GIL $1
+++call (void) PyRun_SimpleString("with open('/tmp/tmp8sav8i6l/rendered_template-1847903.py.out') as f: exec(f.read())")
+++call (void) PyGILState_Release($1)
[Inferior 1 (process 1847903) detached]
Gathering data...
Writing output to file memory_analyzer_out/memory_analyzer_snapshot-20210322174441
Riksou commented 3 years ago

I have made some research and looks like that when graphviz is not installed, the objgraph images are saved as .dot file in /tmp/ folder. I have installed graphviz and now it's working fine. Thank you for helping and sorry for not noticing this before.