Bug #116835 Bug Report for mysql-connector-python (Version 9.1.0)
Submitted: 2 Dec 2024 7:25 Modified: 10 Jan 11:32
Reporter: YOUNGSUNG SHIN Email Updates:
Status: No Feedback Impact on me:
None 
Category:Connector / Python Severity:S2 (Serious)
Version:9.1.0 OS:Windows (windows 10)
Assigned to: MySQL Verification Team CPU Architecture:x86
Tags: build, failed, pyinstaller, runtime error

[2 Dec 2024 7:25] YOUNGSUNG SHIN
Description:
When using mysql-connector-python version 9.1.0 with PyInstaller to build an executable, attempting to connect to a database using the built file results in an unknown error [raising error]. The issue appears consistently and the stack trace indicates the following sequence:

File "mysql\connector\pooling.py", line 322, in connect
File "mysql\connector\connection_cext.py", line 151, in __init__
File "mysql\connector\abstracts.py", line 1426, in connect
File "mysql\connector\connection_cext.py", line 336, in _open_connection
After downgrading to mysql-connector-python version 8.4.0 and rebuilding with PyInstaller, the problem no longer occurs, and the database connection works as expected.

How to repeat:
Use mysql-connector-python version 9.1.0 in a Python project that connects to a MySQL database.
Create a script that connects to the database using mysql.connector.connect().
Build the script using PyInstaller with the following command:
pyinstaller --onefile script.py
Run the built executable and attempt to connect to the database.
Observe that the executable fails with [raising error].

Suggested fix:
Investigate the changes in version 9.1.0 that affect compatibility with PyInstaller.
Ensure all required imports and dependencies are included during the PyInstaller build process.
Provide clear error messages or documentation if additional configuration is needed for compatibility with PyInstaller.
Verify and test compatibility with PyInstaller as part of release validation.
[4 Dec 2024 23:21] Emily Richmond
We have a similar issue with version 9.1.0 when we use it we get a runtime error. 

Error: Runtime exited with error: signal: segmentation fault Runtime.ExitError

When we downgrade to 9.0.0 we have no issues. 

We have an AWS lambda with Python 3.11 and use Poetry for package management. However, it results in a runtime error. 

We would like to be able to use 9.1.0 so that we can resolve the high-security vulnerability, CVE-2024-21272, on 9.0.0.
[10 Dec 2024 11:32] MySQL Verification Team
Hello YOUNGSUNG SHIN,

Thank you for the report and feedback.
I tried to reproduce the reported issue at my end but not seeing any issues(sorry for my not much experience with PyInstaller). I'm shortly attaching the test results from my environment. Am I missing something? Thank you.

Appreciate if you can provide the test case ( python script, exact steps used for building the executable, environment details etc.) to reproduce the issue at our end. Thank you.

regards,
Umesh
[10 Dec 2024 11:34] MySQL Verification Team
Test result

Attachment: 116835.results (application/octet-stream, text), 9.09 KiB.

[11 Jan 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".