nschloe / tuna

:fish: Python profile viewer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Broken Pipe

anklebreaker opened this issue · comments

Quick question, was getting a broken pipe message when running the tuna command. The tab opens up in browser but is unable to connect. Any idea on the cause?

Exception happened during processing of request from ('127.0.0.1', 63304)
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/socketserver.py", line 316, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/socketserver.py", line 347, in process_request
    self.finish_request(request, client_address)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/socketserver.py", line 360, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/socketserver.py", line 720, in __init__
    self.handle()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/server.py", line 427, in handle
    self.handle_one_request()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/server.py", line 415, in handle_one_request
    method()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/tuna/main.py", line 64, in do_GET
    self.wfile.write(content)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/socketserver.py", line 799, in write
    self._sock.sendall(b)
BrokenPipeError: [Errno 32] Broken pipe

Running on MacOS Catalina, Python 3.8 and Chrome

No idea.

I have a fat project in django what take long time to start ... i generate the profile and tuna cannot open...

http://transfer.sh/1DKbkv6/cprofile.out

I generate the HTML files and the output was 2GB of HTML the unique tool it could open is cprofilev

Hi. FYI, i got the same error as @anklebreaker running on wsl2 Windows11

I'm getting a similar error while using tuna 0.5.9 + python3.8 + Chrome 93.0.4577.63 + Ubuntu 18.04:

~$tuna out.cprofile 
Starting httpd on port 8000
127.0.0.1 - - [22/Oct/2021 11:40:29] "GET / HTTP/1.1" 200 -
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 53870)
Traceback (most recent call last):
  File "/usr/lib/python3.8/socketserver.py", line 316, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/usr/lib/python3.8/socketserver.py", line 347, in process_request
    self.finish_request(request, client_address)
  File "/usr/lib/python3.8/socketserver.py", line 360, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python3.8/socketserver.py", line 747, in __init__
    self.handle()
  File "/usr/lib/python3.8/http/server.py", line 427, in handle
    self.handle_one_request()
  File "/usr/lib/python3.8/http/server.py", line 415, in handle_one_request
    method()
  File "/home/apeplowski/envs/py38_tf2_env/lib/python3.8/site-packages/tuna/main.py", line 53, in do_GET
    self.wfile.write(render(data, prof_filename).encode())
  File "/usr/lib/python3.8/socketserver.py", line 826, in write
    self._sock.sendall(b)
BrokenPipeError: [Errno 32] Broken pipe
----------------------------------------
127.0.0.1 - - [22/Oct/2021 11:42:03] "GET /static/tuna.css HTTP/1.1" 200 -
127.0.0.1 - - [22/Oct/2021 11:42:03] "GET /static/bootstrap.min.css HTTP/1.1" 200 -
127.0.0.1 - - [22/Oct/2021 11:42:03] "GET /static/favicon256.png HTTP/1.1" 200 -

Same here :( My .prof file is 1.9M, not sure if this could be caused by too much data

Same error on my side. 2.9 MB for the file. Seems maybe too complicated to handle using a request?

I came to tune after hitting this limitation of snakeviz -- thanks for filing that issue btw!

When loading a large-ish .prof file (2.9MiB), the browser tab crashes (out of memory?). I think the "Broken Pipe" is a consequence of the tab crashing, not the cause of it. FWIW, I tried it both with a recent Brave and Firefox. Same thing in both browsers.

A smaller .prof file (1MiB) loads OK, although it seems to bog down the browser quite a bit.

Tuna: version 0.5.11
Brave: Version 1.39.122 Chromium: 102.0.5005.115 (Official Build)
Python 3.8.12

Unfortunately unusable with my sample on 2.3 MiB of traces with the same symptom -- browser tab crashing and breaking the connection. It is able to render another sample with 700 KiB of data though.

Tuna: 0.5.11
Python: 3.10.6
OS: macOS 13.6.1

same issue here, i got files of ~3MB. any idea how to get around this?

I think this issue is caused by the giant graph data generated in the HTML file. I tried with a 2.1MiB trace file and the browser crashed. I used wget to download the page directly, and the downloaded HTML file is as huge as 663MiB. It has 64 lines and one of them is an incredibly long x-icicle data. Even vim is struggling with opening this file.

Not sure if format the x-icicle data into multiple-lines would help with this issue, or probably it needs interactive partial loading like snakeviz?