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 240 forks source link

seleniumwire.thirdparty.mitmproxy.exceptions.TcpDisconnect: [Errno 104] Connection reset by peer #690

Open SirLateAutumns opened 1 year ago

SirLateAutumns commented 1 year ago

I am using multithreading to start multiple instances of Chrome for work, and have also called the 'driver. quit()' method after working. At the beginning, it was very normal, but after running for about 1-2 hours, this error occasionally appeared. Upon checking the log situation, it seemed that the work was still continuing. However, after 5-6 hours, my task could not be completed, as if Chrome had not been opened. I used · wait For Request · Unable to wait for the request.

My work environment is: Ubuntu22.04 TLS python 3.9.16 selenium-wire 5.1.0 undetected-chromedriver 3.5.0

SirLateAutumns commented 1 year ago

Error details: Traceback (most recent call last): File "//miniconda3/envs//lib/python3.9/site-packages/seleniumwire/thirdparty/mitmproxy/net/tcp.py", line 94, in write r = self.o.write(v) File "//miniconda3/envs//lib/python3.9/socket.py", line 722, in write return self._sock.send(b) ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "//miniconda3/envs//lib/python3.9/site-packages/seleniumwire/thirdparty/mitmproxy/server/server.py", line 113, in handle root_layer() File "//miniconda3/envs//lib/python3.9/site-packages/seleniumwire/thirdparty/mitmproxy/server/modes/http_proxy.py", line 23, in call layer() File "//miniconda3/envs//lib/python3.9/site-packages/seleniumwire/thirdparty/mitmproxy/server/protocol/tls.py", line 285, in call layer() File "//miniconda3/envs//lib/python3.9/site-packages/seleniumwire/thirdparty/mitmproxy/server/protocol/http1.py", line 100, in call layer() File "//miniconda3/envs//lib/python3.9/site-packages/seleniumwire/thirdparty/mitmproxy/server/protocol/http.py", line 206, in call if not self._process_flow(flow): File "//miniconda3/envs//lib/python3.9/site-packages/seleniumwire/thirdparty/mitmproxy/server/protocol/http.py", line 288, in _process_flow return self.handle_upstream_connect(f) File "//miniconda3/envs//lib/python3.9/site-packages/seleniumwire/thirdparty/mitmproxy/server/protocol/http.py", line 246, in handle_upstream_connect self.send_request(f.request) File "//miniconda3/envs//lib/python3.9/site-packages/seleniumwire/thirdparty/mitmproxy/server/protocol/http1.py", line 44, in send_request self.server_conn.wfile.write(http1.assemble_request(request)) File "//miniconda3/envs//lib/python3.9/site-packages/seleniumwire/thirdparty/mitmproxy/net/tcp.py", line 98, in write raise exceptions.TcpDisconnect(str(e)) seleniumwire.thirdparty.mitmproxy.exceptions.TcpDisconnect: [Errno 104] Connection reset by peer

SirLateAutumns commented 1 year ago

In addition, under Linux, use the nohup command to run the script in the background. There are always some chrome processes or unspecified chromedriver processes that become Zombie process and cannot be closed normally. When closing the driver, I also used · driver. service. process. wait() · to wait for the Child process to close, but it seems useless.

I would be grateful if you could ask for help.

SirLateAutumns commented 1 year ago

The error thrown by the browser is: TisProocolExcenicon(Canot cstblish TLS with a www.xxxx.com:443 (ni: www.xxxx.com); TsExcepton('SSL iandshake emor: SysCalEror(1D4, 'ECONNRESET)")