Bug #82789 Checking for EINTR in Python connector
Submitted: 29 Aug 2016 15:57
Reporter: Mihai Ciumeica Email Updates:
Status: Open Impact on me:
Category:Connector / Python Severity:S4 (Feature request)
Version: OS:Linux
Assigned to: CPU Architecture:Any

[29 Aug 2016 15:57] Mihai Ciumeica
When the socket recv() call is interrupted by an EINTR, the MySQL Python connector catches the resulting Python `IOError` and raises its own `OperationalError` exception, which does not include the `IOError.errno` field and does not reference the original `IOError` (for an example, see the `mysql.connector.network.recv_plain` method.)

We would like to retry the network call on EINTR; however, there's no reliable way to detect it at the moment. The closest we can get is searching the OperationalError message string for the words "system error: 4 Interrupted system call". However, this message looks to be locale-specific, and it might change in a future product version, so the method doesn't seem future-proof.

How to repeat:
Launch a long-running MySQL query using the connector, then send a signal to the Python process.

Suggested fix:
Either reference the original IOError in the OperationalError object, or set the `errno` field when raising the exception.