raven-python
raven-python copied to clipboard
socket.timeout: _ssl.c:817: The handshake operation timed out
Occasionally, sentry fails to track errors on our EC2 instances in production. This has been happening on different installs with different versions of raven for the past months. The problem might be related to #1109.
Sentry responded with an error: <urlopen error _ssl.c:817: The handshake operation timed out> (url: https://sentry.io/api/xxx/store/)
Traceback (most recent call last):
File "/usr/lib/python3.6/urllib/request.py", line 1318, in do_open
encode_chunked=req.has_header('Transfer-encoding'))
File "/usr/lib/python3.6/http/client.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/lib/python3.6/http/client.py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/lib/python3.6/http/client.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/lib/python3.6/http/client.py", line 1026, in _send_output
self.send(msg)
File "/usr/lib/python3.6/http/client.py", line 964, in send
self.connect()
File "/usr/local/lib/python3.6/dist-packages/raven/utils/http.py", line 38, in connect
sock, ca_certs=ca_certs, cert_reqs=ssl.CERT_REQUIRED)
File "/usr/lib/python3.6/ssl.py", line 1149, in wrap_socket
ciphers=ciphers)
File "/usr/lib/python3.6/ssl.py", line 814, in __init__
self.do_handshake()
File "/usr/lib/python3.6/ssl.py", line 1068, in do_handshake
self._sslobj.do_handshake()
File "/usr/lib/python3.6/ssl.py", line 689, in do_handshake
self._sslobj.do_handshake()
socket.timeout: _ssl.c:817: The handshake operation timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/raven/transport/threaded.py", line 165, in send_sync
super(ThreadedHTTPTransport, self).send(url, data, headers)
File "/usr/local/lib/python3.6/dist-packages/raven/transport/http.py", line 43, in send
ca_certs=self.ca_certs,
File "/usr/local/lib/python3.6/dist-packages/raven/utils/http.py", line 66, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib/python3.6/urllib/request.py", line 526, in open
response = self._open(req, data)
File "/usr/lib/python3.6/urllib/request.py", line 544, in _open
'_open', req)
File "/usr/lib/python3.6/urllib/request.py", line 504, in _call_chain
result = func(*args)
File "/usr/local/lib/python3.6/dist-packages/raven/utils/http.py", line 46, in https_open
return self.do_open(ValidHTTPSConnection, req)
File "/usr/lib/python3.6/urllib/request.py", line 1320, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error _ssl.c:817: The handshake operation timed out>
python: python 3.6.5 on Ubuntu 16.04.4 LTS
sentry version: raven==6.5.0
ec2-region: us-east-1b
How did you fix it?
Had the same issue and error on other projects. Solved by setting my system time to correct. The reason is that TLS handshake fails due to the invalid certificate (because of wrong system time). Hope it helps others :)
I suggest closing the the issue if its the case.