Skip to content

Error in timer: InterfaceError('connection already closed',) #281

@tijs

Description

@tijs

I'm running celery worker, cam and beat using the django manage commands and i see the following error in my logs every minute:

django.db.backends in _rollback
Error in timer: InterfaceError('connection already closed',)

I've checked past issues, etc but the only reference to this error dates back to django-celery 2.5.0 while i'm running a recent

django-celery==3.0.23

installed through the django-celery-with-redis package.

i've tried turning off cam and beat but the issue remains so it seems to be specific to celery worker. this is an ubuntu system running postgres 9.1 with the latest psycopg2==2.5.1

Anything i could try to get rid of this error? After a while it results in hanging/idle connections in postgres so just silencing it will not be enough as it would make my database server unresponsive if i leave it running long enough.

Stacktrace (most recent call last):

  File "celery/utils/timer2.py", line 109, in apply_entry
    entry()
  File "celery/utils/timer2.py", line 59, in __call__
    return self.fun(*self.args, **self.kwargs)
  File "celery/utils/timer2.py", line 165, in _reschedules
    return fun(*args, **kwargs)
  File "celery/events/snapshot.py", line 71, in capture
    self.state.freeze_while(self.shutter, clear_after=self.clear_after)
  File "celery/events/state.py", line 232, in freeze_while
    return fun(*args, **kwargs)
  File "celery/events/snapshot.py", line 68, in shutter
    self.on_shutter(self.state)
  File "django/db/transaction.py", line 223, in inner
    return func(*args, **kwargs)
  File "django/db/transaction.py", line 217, in __exit__
    self.exiting(exc_value, self.using)
  File "django/db/transaction.py", line 302, in exiting
    leave_transaction_management(using=using)
  File "django/db/transaction.py", line 66, in leave_transaction_management
    connection.leave_transaction_management()
  File "django/db/backends/__init__.py", line 136, in leave_transaction_management
    self.rollback()
  File "django/db/backends/__init__.py", line 249, in rollback
    self._rollback()
  File "django/db/backends/__init__.py", line 59, in _rollback
    return self.connection.rollback()

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