wkeeling / selenium-wire

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

Full Traceback Displayed Reporting [WinError 10053] An established connection was aborted by the software in your host machine #362

Open theohgr opened 3 years ago

theohgr commented 3 years ago

Receiving infrequent connection errors with a full traceback:

[WinError 10053] An established connection was aborted by the software in your host machine

The errors appear to be retried, and do not effect performance of the scraper, but I'd like to suppress the errors to cleanup the output.

This seems similar to a closed issue I found:

https://github.com/wkeeling/selenium-wire/issues/230

selenium-wire is version 4.4.0. I've suppressed connection errors, but it still bubbles up:

 selenium_wire_options = {
        'suppress_connection_errors': True
    }

...

driver = webdriver.Chrome(options=chrome_options, seleniumwire_options=selenium_wire_options, executable_path=binary_path)

`127.0.0.1:50778: Traceback (most recent call last): File "seleniumwire\thirdparty\mitmproxy\net\tcp.py", line 94, in write r = self.o.write(v) File "socket.py", line 722, in write ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "seleniumwire\thirdparty\mitmproxy\server\server.py", line 113, in handle root_layer() File "seleniumwire\thirdparty\mitmproxy\server\modes\http_proxy.py", line 23, in call layer() File "seleniumwire\thirdparty\mitmproxy\server\protocol\tls.py", line 285, in call layer() File "seleniumwire\thirdparty\mitmproxy\server\protocol\http1.py", line 100, in call layer() File "seleniumwire\thirdparty\mitmproxy\server\protocol\http.py", line 206, in call if not self._process_flow(flow): File "seleniumwire\thirdparty\mitmproxy\server\protocol\http.py", line 288, in _process_flow return self.handle_upstream_connect(f) File "seleniumwire\thirdparty\mitmproxy\server\protocol\http.py", line 251, in handle_upstream_connect self.send_response(f.response) File "seleniumwire\thirdparty\mitmproxy\server\protocol\http.py", line 54, in send_response self.send_response_body(response, [response.data.content]) File "seleniumwire\thirdparty\mitmproxy\server\protocol\http1.py", line 72, in send_response_body self.client_conn.wfile.write(chunk) File "seleniumwire\thirdparty\mitmproxy\net\tcp.py", line 98, in write raise exceptions.TcpDisconnect(str(e)) seleniumwire.thirdparty.mitmproxy.exceptions.TcpDisconnect: [WinError 10053] An established connection was aborted by the software in your host machine`

wkeeling commented 3 years ago

Thanks for this. I'll see if I can quieten these messages.

wkeeling commented 3 years ago

This seems to be a bug introduced in version 4.3.3. A short term fix is to downgrade to 4.3.2:

pip install selenium-wire==4.3.2

Related to #389