Skip to content

datajoint.conn and datajoint.Connection.__init__ fail when using Python 3.11 and MySQL 5.7 #1149

Open
@ethho

Description

@ethho

Bug Report

Description

Please see debugging information in #1148. This issue is mirrored in JIRA: https://datajoint.atlassian.net/browse/PLAT-188

Reproducibility

Include:

  • OS: Linux
  • Python Version: 3.11
  • MySQL Version: 5.7
  • MySQL Deployment Strategy: local-docker
  • DataJoint Version: 0.14.1
  • Minimum number of steps to reliably reproduce the issue
    • On branch dev-tests (commit e4e377a), issue PY_VER=3.11 MYSQL_VER=5.7 docker compose up app to run the pytest suite.
  • Complete error stack as a result of evaluating the above steps
Console Logs
PY_VER=3.11 MYSQL_VER=5.7 docker compose run app pytest tests
[+] Creating 3/0
 ✔ Container ethho-datajoint-python-minio-1                      Running                                                           0.0s 
 ✔ Container ethho-datajoint-python-fakeservices.datajoint.io-1  Running                                                           0.0s 
 ✔ Container ethho-datajoint-python-db-1                         Running                                                           0.0s 
========================================================= test session starts ==========================================================
platform linux -- Python 3.11.0, pytest-7.2.1, pluggy-1.0.0
rootdir: /src
plugins: Faker-16.6.1, cov-4.0.0
collected 290 items / 1 error                                                                                                          

================================================================ ERRORS ================================================================
_________________________________________________ ERROR collecting tests/test_json.py __________________________________________________
/opt/conda/lib/python3.11/site-packages/pymysql/connections.py:633: in connect
    self._request_authentication()
/opt/conda/lib/python3.11/site-packages/pymysql/connections.py:849: in _request_authentication
    self._sock = self.ctx.wrap_socket(self._sock, server_hostname=self.host)
/opt/conda/lib/python3.11/ssl.py:517: in wrap_socket
    return self.sslsocket_class._create(
/opt/conda/lib/python3.11/ssl.py:1075: in _create
    self.do_handshake()
/opt/conda/lib/python3.11/ssl.py:1346: in do_handshake
    self._sslobj.do_handshake()
E   ssl.SSLError: [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:992)

During handling of the above exception, another exception occurred:
tests/test_json.py:8: in <module>
    if Version(dj.conn().query("select @@version;").fetchone()[0]) < Version("8.0.0"):
datajoint/connection.py:133: in conn
    conn.connection = Connection(host, user, password, None, init_fun, use_tls)
datajoint/connection.py:195: in __init__
    connect_host_hook(self)
datajoint/connection.py:52: in connect_host_hook
    connection_obj.connect()
datajoint/connection.py:219: in connect
    self._conn = client.connect(
/opt/conda/lib/python3.11/site-packages/pymysql/connections.py:353: in __init__
    self.connect()
/opt/conda/lib/python3.11/site-packages/pymysql/connections.py:664: in connect
    raise exc
E   pymysql.err.OperationalError: (2003, "Can't connect to MySQL server on 'fakeservices.datajoint.io' ([SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:992))")
----------------------------------------------------------- Captured stderr ------------------------------------------------------------
[2024-01-03 19:53:33,511][INFO]: Connecting [email protected]:3306
======================================================= short test summary info ========================================================
ERROR tests/test_json.py - pymysql.err.OperationalError: (2003, "Can't connect to MySQL server on 'fakeservices.datajoint.io' ([SSL: SSLV3_ALERT_HANDSHAKE_FAI...

Expected Behavior

All pytests pass even when using Python >=3.10 and MySQL 5.7

Screenshots

If applicable, add screenshots to help explain your problem.

Additional Research and Context

See debugging findings documented in #1148.

Metadata

Metadata

Assignees

Labels

bugIndicates an unexpected problem or unintended behaviorstaleIndicates issues, pull requests, or discussions are inactive

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions