Description:
I want to connect in a python3.10 script to a mysql-server over sshtunnel to a MySQL 5.7 Server.
In version 8.0.31 and 8.0.30, the connection just hangs, I can't abort.
In version 8.0.29 and 8.0.28, I get "Segmentation fault (core dumped)".
In version 8.0.27 everything works fine
How to repeat:
prerequisite:
server1: python3.10 with pip packages sshtunnel 0.4.0 and mysql-connector-python 8.0.31
server2: A ssh server with ssh user "sshuser" and password "password123" and a mysql server with a user "mysqluser", a password "password456" and a databse "somedb".
server1:
$ cat bug_test.py
#!/usr/bin/env python3
from mysql import connector
from sshtunnel import SSHTunnelForwarder
with SSHTunnelForwarder(("db.example.com", 22), ssh_username="sshuser", ssh_password="password123",
remote_bind_address=("127.0.0.1", 3306)) as tunnel:
connection = connector.connect(host='127.0.0.1', user="mysqluser", password="password456",
database="somedb", port=tunnel.local_bind_port)
$ python --version
Python 3.10.7
$ pip freeze
bcrypt==4.0.1
cffi==1.15.1
cryptography==38.0.1
mysql-connector-python==8.0.31
paramiko==2.11.0
protobuf==3.20.1
pycparser==2.21
PyNaCl==1.5.0
six==1.16.0
sshtunnel==0.4.0
server2:
$ mysql --version
mysql Ver 14.14 Distrib 5.7.39, for Linux (x86_64) using EditLine wrapper
Suggested fix:
When I just open the port and test it with a separate script, it works. Could it be a multithreading problem?