wkeeling / selenium-wire

Extends Selenium's Python bindings to give you the ability to inspect requests made by the browser.
MIT License
1.86k stars 241 forks source link

seleniumwire.thirdparty.mitmproxy.exceptions.TcpDisconnect: [Errno 32] Broken pipe #641

Open frshman opened 1 year ago

frshman commented 1 year ago

File "/home/liulin/pythonenvs/workspace/lib/python3.8/site-packages/seleniumwire/thirdparty/mitmproxy/net/tcp.py", line 94, in write r = self.o.write(v) File "/usr/local/python3/lib/python3.8/socket.py", line 687, in write return self._sock.send(b) BrokenPipeError: [Errno 32] Broken pipe

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/liulin/pythonenvs/workspace/lib/python3.8/site-packages/seleniumwire/thirdparty/mitmproxy/server/server.py", line 113, in handle root_layer() File "/home/liulin/pythonenvs/workspace/lib/python3.8/site-packages/seleniumwire/thirdparty/mitmproxy/server/modes/http_proxy.py", line 23, in call layer() File "/home/liulin/pythonenvs/workspace/lib/python3.8/site-packages/seleniumwire/thirdparty/mitmproxy/server/protocol/tls.py", line 285, in call layer() File "/home/liulin/pythonenvs/workspace/lib/python3.8/site-packages/seleniumwire/thirdparty/mitmproxy/server/protocol/http1.py", line 100, in call layer() File "/home/liulin/pythonenvs/workspace/lib/python3.8/site-packages/seleniumwire/thirdparty/mitmproxy/server/protocol/http.py", line 206, in call if not self._process_flow(flow): File "/home/liulin/pythonenvs/workspace/lib/python3.8/site-packages/seleniumwire/thirdparty/mitmproxy/server/protocol/http.py", line 288, in _process_flow return self.handle_upstream_connect(f) File "/home/liulin/pythonenvs/workspace/lib/python3.8/site-packages/seleniumwire/thirdparty/mitmproxy/server/protocol/http.py", line 251, in handle_upstream_connect self.send_response(f.response) File "/home/liulin/pythonenvs/workspace/lib/python3.8/site-packages/seleniumwire/thirdparty/mitmproxy/server/protocol/http.py", line 54, in send_response self.send_response_body(response, [response.data.content]) File "/home/liulin/pythonenvs/workspace/lib/python3.8/site-packages/seleniumwire/thirdparty/mitmproxy/server/protocol/http1.py", line 72, in send_response_body self.client_conn.wfile.write(chunk) File "/home/liulin/pythonenvs/workspace/lib/python3.8/site-packages/seleniumwire/thirdparty/mitmproxy/net/tcp.py", line 98, in write raise exceptions.TcpDisconnect(str(e)) seleniumwire.thirdparty.mitmproxy.exceptions.TcpDisconnect: [Errno 32] Broken pipe

//my config env:centos7 selenium-wire:5.1.0 undetected-chromedriver:3.2.1

by the way,i use mutithread,virtualscreen,auth proxy.its work in windows,but centos just raise above error. this problem look like a socket problem,but i have no idea deal it. how can i fix above problem?

frshman commented 1 year ago

addtional,when i dont use proxy,it works...... so weird.

Ishogbon commented 1 year ago

I also faced a similar issue. It's most likely issue with your internet connection or Adapter. Try switching machines and see if the issue still persists.

alfredtofu commented 1 year ago

have you fixed it? @Ishogbon @Ishogbon

Neptunespace commented 7 months ago

Same here, latest ubuntu 23.10, i only see this error when i use proxy http proxy for http and https request (don't know with https proxy) :

ubuntu 23.10 selenium-wire 5.1.0 official http webdriver for chrome (not chromium)

127.0.0.1:47074: Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/seleniumwire/thirdparty/mitmproxy/net/tcp.py", line 94, in write
    r = self.o.write(v)
  File "/usr/lib/python3.10/socket.py", line 723, in write
    return self._sock.send(b)
BrokenPipeError: [Errno 32] Broken pipe

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/seleniumwire/thirdparty/mitmproxy/server/server.py", line 113, in handle
    root_layer()
  File "/usr/local/lib/python3.10/dist-packages/seleniumwire/thirdparty/mitmproxy/server/modes/http_proxy.py", line 23, in __call__
    layer()
  File "/usr/local/lib/python3.10/dist-packages/seleniumwire/thirdparty/mitmproxy/server/protocol/tls.py", line 285, in __call__
    layer()
  File "/usr/local/lib/python3.10/dist-packages/seleniumwire/thirdparty/mitmproxy/server/protocol/http1.py", line 100, in __call__
    layer()
  File "/usr/local/lib/python3.10/dist-packages/seleniumwire/thirdparty/mitmproxy/server/protocol/http.py", line 206, in __call__
    if not self._process_flow(flow):
  File "/usr/local/lib/python3.10/dist-packages/seleniumwire/thirdparty/mitmproxy/server/protocol/http.py", line 288, in _process_flow
    return self.handle_upstream_connect(f)
  File "/usr/local/lib/python3.10/dist-packages/seleniumwire/thirdparty/mitmproxy/server/protocol/http.py", line 251, in handle_upstream_connect
    self.send_response(f.response)
  File "/usr/local/lib/python3.10/dist-packages/seleniumwire/thirdparty/mitmproxy/server/protocol/http.py", line 54, in send_response
    self.send_response_body(response, [response.data.content])
  File "/usr/local/lib/python3.10/dist-packages/seleniumwire/thirdparty/mitmproxy/server/protocol/http1.py", line 72, in send_response_body
    self.client_conn.wfile.write(chunk)
  File "/usr/local/lib/python3.10/dist-packages/seleniumwire/thirdparty/mitmproxy/net/tcp.py", line 98, in write
    raise exceptions.TcpDisconnect(str(e))
seleniumwire.thirdparty.mitmproxy.exceptions.TcpDisconnect: [Errno 32] Broken pipe
unchaineddev commented 7 months ago

I am facing the same issue, but I think there is no fix for this yet.