apscheduler: 'MySQL server has gone away' is raised when connection goes stale while adding to 'apscheduler_jobs'

When connection goes stale either because of non usage or MySQL restart, following error is raised,

1805 2017-09-26 13:39:03,396 [ERROR] sm_lib [__init__.py:56] [write_error]: (_mysql_exceptions.OperationalError) (2006, 'MySQL server has gone away') [SQL: u'INSERT INTO apscheduler_jobs (id, next_run_time, job_state) VALUES (%s, %s, %s)'] [parameters: ('f01b7658d8ae499fb86b9038f9ffc3c6', 1506450600.0, "\x80\x02}q\x01(U\x04argsq\x02\x8a\x01\x19\x85q\x03U\x08executorq\x04U\x07defaultq\x05U\rmax_instancesq\x06K\x01U\x04funcq\x07U:aps_scheduler.scheduler.executer.campaign:campaign_triggerq\x08U\x02idq\tU f01b7658d8ae499fb86b9038f9ffc3c6q\nU\rnext_run_timeq\x0bcdatetime\ndatetime\nq\x0cU\n\x07\xe1\t\x1a\x12\x1e\x00\x00\x00\x00cpytz\n_UTC\nq\r)Rq\x0e\x86Rq\x0fU\x04nameq\x10U\x10campaign_triggerq\x11U\x12misfire_grace_timeq\x12M\x84\x03U\x07triggerq\x13capscheduler.triggers.date\nDateTrigger\nq\x14)\x81q\x15}q\x16(U\x07versionq\x17K\x01U\x08run_dateq\x18h\x0cU\n\x07\xe1\t\x1a\r'\x03\x05\x94mcpytz\n_p\nq\x19U\x07Etc/UTCq\x1a\x85Rq\x1b\x86Rq\x1cubU\x08coalesceq\x1d\x89h\x17K\x01U\x06kwargsq\
 x1e}q\x1fu.")]

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 15 (4 by maintainers)

Most upvoted comments

@pranav93 Yeah. It works well for me.