exasol / pyexasol

Exasol Python driver with low overhead, fast HTTP transport and compression
MIT License
72 stars 39 forks source link

SSL EOF Error #74

Closed kamal-1 closed 3 years ago

kamal-1 commented 3 years ago

When initiating the connection to Exasol, I am getting "ssl.SSLEOFError: EOF occurred in violation of protocol" errors. Do you know any workaround for these?

import pyexasol
c = pyexasol.connect_local_config("ETL_QA", debug=True)

Below is the full traceback. I've tried adding websocket_sslopt={'cert_reqs': ssl.CERT_NONE} & websocket_sslopt={'cert_reqs': ssl.CERT_REQUIRED} options to the connection but none of these helped.

2021-05-12 12:07:50.173 Connection attempt [...:8563] 2021-05-12 12:07:50.247 Failed to connect [...:8563]: EOF occurred in violation of protocol (_ssl.c:1045) Traceback (most recent call last): File "/tmp/envs/venv/lib/python3.7/site-packages/pyexasol/connection.py", line 654, in _init_ws self._ws = websocket.create_connection(f'{ws_prefix}{host}:{port}', ws_options) File "/tmp/envs/venv/lib/python3.7/site-packages/websocket/_core.py", line 515, in create_connection websock.connect(url, options) File "/tmp/envs/venv/lib/python3.7/site-packages/websocket/_core.py", line 223, in connect options.pop('socket', None)) File "/tmp/envs/venv/lib/python3.7/site-packages/websocket/_http.py", line 127, in connect sock = _ssl_socket(sock, options.sslopt, hostname) File "/tmp/envs/venv/lib/python3.7/site-packages/websocket/_http.py", line 264, in _ssl_socket sock = _wrap_sni_socket(sock, sslopt, hostname, check_hostname) File "/tmp/envs/venv/lib/python3.7/site-packages/websocket/_http.py", line 243, in _wrap_sni_socket server_hostname=hostname, File "/tmp/envs/venv/lib/python3.7/ssl.py", line 412, in wrap_socket session=session File "/tmp/envs/venv/lib/python3.7/ssl.py", line 850, in _create self.do_handshake() File "/tmp/envs/venv/lib/python3.7/ssl.py", line 1108, in do_handshake self._sslobj.do_handshake() ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:1045)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "", line 1, in File "/tmp/envs/venv/lib/python3.7/site-packages/pyexasol/init.py", line 72, in connect_local_config return connect({conf_args, kwargs}) File "/tmp/envs/venv/lib/python3.7/site-packages/pyexasol/init.py", line 54, in connect return ExaConnection(kwargs) File "/tmp/envs/venv/lib/python3.7/site-packages/pyexasol/connection.py", line 176, in init self._init_ws() File "/tmp/envs/venv/lib/python3.7/site-packages/pyexasol/connection.py", line 670, in _init_ws raise ExaConnectionFailedError(self, 'Could not connect to Exasol: ' + str(e)) pyexasol.exceptions.ExaConnectionFailedError: ( message => Could not connect to Exasol: EOF occurred in violation of protocol (_ssl.c:1045) dsn => user => schema => session_id => )

This issue is happening for only one of the clusters. 2 other clusters are connecting file without any issues.

littleK0i commented 3 years ago

Does it work without encryption? encryption=False

kamal-1 commented 3 years ago

@wildraid: I cannot turn off the encryption. DBA's have set -forceProtocolEncryption=1 at the database level.

When I try to set the encryption=False I get the following error. message => Connection exception - Client connection must be encrypted.

littleK0i commented 3 years ago

Ok, it means it works. At least, it reaches the database.

What is your Exasol version? It it possible your Exasol version is a bit old and affected by this bug? https://www.exasol.com/support/browse/EXASOL-2829

kamal-1 commented 3 years ago

We upgraded to version 7.0.9 just this Monday. Since then we have not been able to connect. We initially thought it was an issue with the certificate we uploaded in ExaOperations but afterwards we have tried uploading self signed certificate as well but nothing seems to resolve the issue.

littleK0i commented 3 years ago

Aha! It might be related to this change somehow: https://www.exasol.com/support/browse/EXASOL-2878

It was the only change in 7.0.9. I suspect, it did not go well for WebSocket clients.

Please try to raise a ticket for customer support, and let's see how it goes.

kamal-1 commented 3 years ago

Thanks @wildraid. Like you mentioned, this was an issue with the certs only. We were able to upload new certs that resolved the issue.