Ticket #68 (accepted defect)

Opened 13 years ago

Last modified 13 years ago

Pykota mysql connection timeout

Reported by: ryan Owned by: jerome
Priority: minor Milestone:
Component: pykota Version: stable
Keywords: Cc:

Description

When a print job gets stuck in the queue for a long time, pykota fails. I don't yet know why jobs get stuck. Maybe the printer is out of paper when nobody is around to refill it.

When cupspykota is finally able to print, it tries to connect to the mysql database and fails. The connection gets lost after 8 hours due to the default wait_timeout in mysqld.

Here is an example of such a job from the logs:

messages:Jan 24 16:54:44 <host> PyKota: (PID 31610) : <user>(9389) => Job accounting begins.
messages:Jan 24 16:54:50 <host> PyKota: (PID 31610) : <user>(9389) => CUPS backend /usr/lib/cups/backend/socket returned 0.
messages:Jan 25 08:26:34 <host> PyKota: (PID 31610) : <user>(9389) => Job accounting ends.

error_log:E [25/Jan/2011:08:26:34 -0500] [Job 9389] PyKota v1.26_official
error_log:E [25/Jan/2011:08:26:34 -0500] [Job 9389] cupspykota backend failed
error_log:E [25/Jan/2011:08:26:34 -0500] [Job 9389] Traceback (most recent call last):
error_log:E [25/Jan/2011:08:26:34 -0500] [Job 9389] File "/usr/lib/cups/backend/cupspykota", line 1474, in ?
error_log:E [25/Jan/2011:08:26:34 -0500] [Job 9389] File "/usr/lib/cups/backend/cupspykota", line 1135, in mainWork
error_log:E [25/Jan/2011:08:26:34 -0500] [Job 9389] File "/usr/lib/cups/backend/cupspykota", line 1271, in doWork
error_log:E [25/Jan/2011:08:26:34 -0500] [Job 9389] File "/usr/lib/python2.4/site-packages/pykota/storages/mysqlstorage.py", line 78, in beginTransaction
error_log:E [25/Jan/2011:08:26:34 -0500] [Job 9389] self.cursor.execute("BEGIN;")
error_log:E [25/Jan/2011:08:26:34 -0500] [Job 9389] File "/usr/lib/python2.4/site-packages/MySQLdb/cursors.py", line 166, in execute
error_log:E [25/Jan/2011:08:26:34 -0500] [Job 9389] self.errorhandler(self, exc, value)
error_log:E [25/Jan/2011:08:26:34 -0500] [Job 9389] File "/usr/lib/python2.4/site-packages/MySQLdb/connections.py", line 35, in defaulterrorhandler
error_log:E [25/Jan/2011:08:26:34 -0500] [Job 9389] raise errorclass, errorvalue
error_log:E [25/Jan/2011:08:26:34 -0500] [Job 9389] OperationalError?: (2006, 'MySQL server has gone away')

Maybe pykota could try to reconnect to the mysql database in this case?

Change History

Changed 13 years ago by jerome

  • status changed from new to accepted

You're perfectly right, this issue should be addressed soon.
It's already done for the LDAP backend, but not for the relational ones, and I've seen lots of errors reported with "MySQL server has gone away" but I didn't know the cause until now. I don't think PostgreSQL times out, or the library does the automatic reconnection, but just in case I'll try to do the same for all three relational backends ASAP.

Note: See TracTickets for help on using tickets.