Bug #98432 Python Connector throws error on Linux with SSH Tunnel

Submitted: 29 Jan 2020 16:29 Modified: 6 Feb 2020 21:47
Reporter: Jason Miele Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / Python Severity:S3 (Non-critical)
Version:8.0.19 OS:CentOS
Assigned to: CPU Architecture:x86
Tags: SSH tunnel

[29 Jan 2020 16:29] Jason Miele
Description:
When using MySQL Python Connector 8.0.19 through an SSH Tunnel.  After the Python Connection is close and shutdown, the SSH Tunnel is closed and the Python program exits, a error is thrown by the Python Connector.  This only happens with a connection over an SSH Tunnel and not with a direct connection to the database.  We believe the issue is with the ‘self.sock.shutdown(socket.SHUT_RDWR)’ method in the network.py > shutdown method which is called by the __del__ method.  This is only happens on Linux (not Windows).  

Error: 
Exception ignored in: <bound method BaseMySQLSocket.__del__ of <MySQL.connector.network.MySQLTCPSocket object at 0x##########>
Traceback:
network.py, line 153 in __del__
network.py, line 137 in shutdown
TypeError: catching classes that do not inherit from BaseException is not allowed

How to repeat:
0) On Linux (CLSE 7)
1) In Python, create SSH tunnel.
2) Create a connection to MySQL with the Python Connector over the SSH Tunnel
3) Run a query
4) Close the Python Connector (close and shutdown)
5) Close the SSH tunnel

6) When the Python program exits and error will be thrown.  

Suggested fix:
‘self.sock.shutdown(socket.SHUT_RDWR)’   catch the error and ignore it which is what was done in past versions of the Python Connector.
[4 Feb 2020 6:57] MySQL Verification Team
Hello Jason,

Thank you for the report and feedback.
I tried to reproduce the issue at my end but I'm not seeing any issues. May I request you to please provide us exact test case(python script) to reproduce this issue at our end? Thank you.

regards,
Umesh
[4 Feb 2020 6:58] MySQL Verification Team
Test results - 8.0.19

Attachment: 98432.results (application/octet-stream, text), 3.08 KiB.

[6 Feb 2020 21:47] Jason Miele
seems to only happen when in a subclass

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.041 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.