Skip to content

Error in timer: OperationalError(2006, 'MySQL server has gone away') #406

Closed
@marco-silva0000

Description

@marco-silva0000

system runs normally until something happens and worker stops running tasks until manually restarted.

I've applied the fix #370, for issue #359, but the error persists.

I have:
Django==1.6
celery==3.1.5
django-celery==3.1.1
MySQL-python==1.2.4
kombu==3.0.6

My traceback is:

[2015-12-10 09:50:43,300: ERROR/MainProcess] Error in timer: OperationalError(2006, 'MySQL server has gone away')
Traceback (most recent call last):
  File "/opt/virtualenvs/simocEnv/local/lib/python2.7/site-packages/kombu/async/timer.py", line 171, in apply_entry
    entry()
  File "/opt/virtualenvs/simocEnv/local/lib/python2.7/site-packages/kombu/async/timer.py", line 64, in __call__
    return self.fun(*self.args, **self.kwargs)
  File "/opt/virtualenvs/simocEnv/local/lib/python2.7/site-packages/kombu/async/timer.py", line 132, in _reschedules
    return fun(*args, **kwargs)
  File "/opt/virtualenvs/simocEnv/local/lib/python2.7/site-packages/celery/events/snapshot.py", line 73, in capture
    self.state.freeze_while(self.shutter, clear_after=self.clear_after)
  File "/opt/virtualenvs/simocEnv/local/lib/python2.7/site-packages/celery/events/state.py", line 428, in freeze_while
    return fun(*args, **kwargs)
  File "/opt/virtualenvs/simocEnv/local/lib/python2.7/site-packages/celery/events/snapshot.py", line 70, in shutter
    self.on_shutter(self.state)
  File "/opt/virtualenvs/simocEnv/local/lib/python2.7/site-packages/djcelery/snapshot.py", line 139, in on_shutter
    _handle_tasks()
  File "/opt/virtualenvs/simocEnv/local/lib/python2.7/site-packages/djcelery/snapshot.py", line 135, in _handle_tasks
    self.handle_task(task)
  File "/opt/virtualenvs/simocEnv/local/lib/python2.7/site-packages/djcelery/snapshot.py", line 82, in handle_task
    (task.worker.hostname, task.worker),
  File "/opt/virtualenvs/simocEnv/local/lib/python2.7/site-packages/djcelery/snapshot.py", line 72, in handle_worker
    defaults={'last_heartbeat': self.get_heartbeat(worker)},
  File "/opt/virtualenvs/simocEnv/local/lib/python2.7/site-packages/djcelery/managers.py", line 87, in update_or_create
    return get_queryset(self).update_or_create(**kwargs)
  File "/opt/virtualenvs/simocEnv/local/lib/python2.7/site-packages/djcelery/managers.py", line 70, in update_or_create
    obj, created = self.get_or_create(**kwargs)
  File "/opt/virtualenvs/simocEnv/local/lib/python2.7/site-packages/django/db/models/query.py", line 373, in get_or_create
    return self.get(**lookup), False
  File "/opt/virtualenvs/simocEnv/local/lib/python2.7/site-packages/django/db/models/query.py", line 301, in get
    num = len(clone)
  File "/opt/virtualenvs/simocEnv/local/lib/python2.7/site-packages/django/db/models/query.py", line 77, in __len__
    self._fetch_all()
  File "/opt/virtualenvs/simocEnv/local/lib/python2.7/site-packages/django/db/models/query.py", line 854, in _fetch_all
    self._result_cache = list(self.iterator())
  File "/opt/virtualenvs/simocEnv/local/lib/python2.7/site-packages/django/db/models/query.py", line 220, in iterator
    for row in compiler.results_iter():
  File "/opt/virtualenvs/simocEnv/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 710, in results_iter
    for rows in self.execute_sql(MULTI):
  File "/opt/virtualenvs/simocEnv/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 781, in execute_sql
    cursor.execute(sql, params)
  File "/opt/virtualenvs/simocEnv/local/lib/python2.7/site-packages/django/db/backends/util.py", line 53, in execute
    return self.cursor.execute(sql, params)
  File "/opt/virtualenvs/simocEnv/local/lib/python2.7/site-packages/django/db/utils.py", line 99, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/opt/virtualenvs/simocEnv/local/lib/python2.7/site-packages/django/db/backends/util.py", line 53, in execute
    return self.cursor.execute(sql, params)
  File "/opt/virtualenvs/simocEnv/local/lib/python2.7/site-packages/django/db/backends/mysql/base.py", line 124, in execute
    return self.cursor.execute(query, args)
  File "/opt/virtualenvs/simocEnv/local/lib/python2.7/site-packages/MySQLdb/cursors.py", line 205, in execute
    self.errorhandler(self, exc, value)
  File "/opt/virtualenvs/simocEnv/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
OperationalError: (2006, 'MySQL server has gone away')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions