MySQL Forums
Forum List  »  Connector/Python

Error 10053 (lost connection) at COMMIT after long SELECT
Posted by: John Nagle
Date: May 15, 2015 02:28PM

I'm running a long job in Python which has done a SELECT which returns about 2.2 million rows. The rows are read with "readmany" in blocks of 25,000. A block of rows is read about every 10 minutes. That works fine.

After all the records are read, the program does a COMMIT to release the state held by the SELECT. (Repeatable-read mode.) This fails:

891:58.54 [MainThread] FAILED: OperationalError(2006, "MySQL server has gone away (ConnectionAbortedError(10053, 'An established connection was aborted by the software in your host machine', None, 10053, None))")
Traceback (most recent call last):
File "c:\python34\lib\site-packages\pymysql\connections.py", line 914, in _write_bytes
self.socket.sendall(data)
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine

Traceback (most recent call last):
File "..\InfoCompanyDb.py", line 179, in reparseindex
self.reparsefails(dbinfo)
File "..\InfoCompanyDb.py", line 337, in reparsefails
self.db.commit()
File "c:\python34\lib\site-packages\pymysql\connections.py", line 705, in commit
self._execute_command(COMMAND.COM_QUERY, "COMMIT")
File "c:\python34\lib\site-packages\pymysql\connections.py", line 957, in _execute_command
self._write_bytes(prelude + sql[:chunk_size-1])
File "c:\python34\lib\site-packages\pymysql\connections.py", line 916, in _write_bytes
raise err.OperationalError(2006, "MySQL server has gone away (%r)" % (e,))
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionAbortedError(10053, 'An established connection was aborted by the software in your host machine', None, 10053, None))")

This isn't a networking problem; host and client are on the same Windows 7 machine (this is a test environment).
The database connection hasn't been idle; it's been used every 10 minutes for almost 24 hours as rows are read with "readmany". But
no new command has been sent for almost a day. Should the connection time out like that? Is there something I can do during this big SELECT to keep the connection alive?

Windows 7
MySQL Server and client on same machine
Server version: 5.1.47-community MySQL Community Server (GPL)
Python connector PyMySQL

Options: ReplyQuote


Subject
Written By
Posted
Error 10053 (lost connection) at COMMIT after long SELECT
May 15, 2015 02:28PM


Sorry, you can't reply to this topic. It has been closed.

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.