Quantcast
Channel: MySQL Forums - Connector/Python
Viewing all articles
Browse latest Browse all 384

Error 10053 (lost connection) at COMMIT after long SELECT (1 reply)

$
0
0
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

Viewing all articles
Browse latest Browse all 384

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>