while true; do kill -USR1 <PID>; sleep 0.001; done
After some time if will fail with:
$ python test_signal.py
Traceback (most recent call last):
File "test_signal.py", line 12, in <module>
assert len(list(cursor)) == cursor.rowcount
AssertionError
After fix it fails only with:
python test_signal.py
Traceback (most recent call last):
File "test_signal.py", line 11, in <module>
cursor.execute("SELECT SQL_NO_CACHE row_id FROM big_table")
File "/home/dldmitry/Work/github.com/blackwithwhite666/MySQLdb1/MySQLdb/cursors.py", line 205, in execute
self.errorhandler(self, exc, value)
File "/home/dldmitry/Work/github.com/blackwithwhite666/MySQLdb1/MySQLdb/connections.py", line 36, in defaulterrorhandler
raise errorclass, errorvalue
_mysql_exceptions.OperationalError: (2013, 'Lost connection to MySQL server during query')
Hi!
Seem that driver doesn't properly check for error after call to
mysql_store_result
. Currently, it callsmysql_field_count
whenmysql_store_result
returnsNULL
but throws an error only ifmysql_field_count
result is greather then zero, which contradicts with one doc - https://dev.mysql.com/doc/refman/5.5/en/mysql-store-result.html but not with another - https://dev.mysql.com/doc/refman/5.5/en/mysql-field-count.html. That is why i replace check with call tomysql_errno
.I can check it with this code (not very effective method, but it works):
Start script and send SIGUSR1 to it:
After some time if will fail with:
After fix it fails only with:
Which is expected behavior for libmysqlclient.