question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Celerybeat container fails to start

See original GitHub issue

What happened?

Using an out of the box cookiecutter-django project, with default generation options, except for enabling docker and celery. When running the project, the celerybeat container fails to start.

What should’ve happened instead?

The celerybeat container should start successfully.

Steps to reproduce

Project generation options (all default, except enable docker and celery)

project_name [My Awesome Project]: testcelery
project_slug [testcelery]:
description [Behold My Awesome Project!]:
author_name [Daniel Roy Greenfeld]:
domain_name [example.com]:
email [daniel-roy-greenfeld@example.com]:
version [0.1.0]:
Select open_source_license:
1 - MIT
2 - BSD
3 - GPLv3
4 - Apache Software License 2.0
5 - Not open source
Choose from 1, 2, 3, 4, 5 [1]:
timezone [UTC]:
windows [n]:
use_pycharm [n]:
use_docker [n]: y
Select postgresql_version:
1 - 10.4
2 - 10.3
3 - 10.2
4 - 10.1
5 - 9.6
6 - 9.5
7 - 9.4
8 - 9.3
Choose from 1, 2, 3, 4, 5, 6, 7, 8 [1]:
Select js_task_runner:
1 - None
2 - Gulp
Choose from 1, 2 [1]:
custom_bootstrap_compilation [n]:
use_compressor [n]:
use_celery [n]: y
use_mailhog [n]:
use_sentry [n]:
use_whitenoise [n]:
use_heroku [n]:
use_travisci [n]:
keep_local_envs_in_vcs [y]:
debug [n]:

celerybeat logs from docker up

celerybeat_1    | PostgreSQL is available
celerybeat_1    | celery beat v4.2.1 (windowlicker) is starting.
celerybeat_1    | __    -    ... __   -        _
celerybeat_1    | LocalTime -> 2018-09-07 21:29:49
celerybeat_1    | Configuration ->
celerybeat_1    |     . broker -> redis://redis:6379/0
celerybeat_1    |     . loader -> celery.loaders.app.AppLoader
celerybeat_1    |     . scheduler -> celery.beat.PersistentScheduler
celerybeat_1    |     . db -> celerybeat-schedule
celerybeat_1    |     . logfile -> [stderr]@%INFO
celerybeat_1    |     . maxinterval -> 5.00 minutes (300s)
celerybeat_1    | [2018-09-07 21:29:49,944: INFO/MainProcess] beat: Starting...
celerybeat_1    | [2018-09-07 21:29:49,973: ERROR/MainProcess] Removing corrupted schedule file 'celerybeat-schedule': error(22, 'Invalid argument')
celerybeat_1    | Traceback (most recent call last):
celerybeat_1    |   File "/usr/local/lib/python3.6/site-packages/kombu/utils/objects.py", line 42, in __get__
celerybeat_1    |     return obj.__dict__[self.__name__]
celerybeat_1    | KeyError: 'scheduler'
celerybeat_1    |
celerybeat_1    | During handling of the above exception, another exception occurred:
celerybeat_1    |
celerybeat_1    | Traceback (most recent call last):
celerybeat_1    |   File "/usr/local/lib/python3.6/site-packages/celery/beat.py", line 476, in setup_schedule
celerybeat_1    |     self._store = self._open_schedule()
celerybeat_1    |   File "/usr/local/lib/python3.6/site-packages/celery/beat.py", line 466, in _open_schedule
celerybeat_1    |     return self.persistence.open(self.schedule_filename, writeback=True)
celerybeat_1    |   File "/usr/local/lib/python3.6/shelve.py", line 243, in open
celerybeat_1    |     return DbfilenameShelf(filename, flag, protocol, writeback)
celerybeat_1    |   File "/usr/local/lib/python3.6/shelve.py", line 227, in __init__
celerybeat_1    |     Shelf.__init__(self, dbm.open(filename, flag), protocol, writeback)
celerybeat_1    |   File "/usr/local/lib/python3.6/dbm/__init__.py", line 94, in open
celerybeat_1    |     return mod.open(file, flag, mode)
celerybeat_1    | _gdbm.error: [Errno 22] Invalid argument
celerybeat_1    | [2018-09-07 21:29:50,008: CRITICAL/MainProcess] beat raised exception <class '_gdbm.error'>: error(22, 'Invalid argument')
celerybeat_1    | Traceback (most recent call last):
celerybeat_1    |   File "/usr/local/lib/python3.6/site-packages/kombu/utils/objects.py", line 42, in __get__
celerybeat_1    |     return obj.__dict__[self.__name__]
celerybeat_1    | KeyError: 'scheduler'
celerybeat_1    |
celerybeat_1    | During handling of the above exception, another exception occurred:
celerybeat_1    |
celerybeat_1    | Traceback (most recent call last):
celerybeat_1    |   File "/usr/local/lib/python3.6/site-packages/celery/beat.py", line 476, in setup_schedule
celerybeat_1    |     self._store = self._open_schedule()
celerybeat_1    |   File "/usr/local/lib/python3.6/site-packages/celery/beat.py", line 466, in _open_schedule
celerybeat_1    |     return self.persistence.open(self.schedule_filename, writeback=True)
celerybeat_1    |   File "/usr/local/lib/python3.6/shelve.py", line 243, in open
celerybeat_1    |     return DbfilenameShelf(filename, flag, protocol, writeback)
celerybeat_1    |   File "/usr/local/lib/python3.6/shelve.py", line 227, in __init__
celerybeat_1    |     Shelf.__init__(self, dbm.open(filename, flag), protocol, writeback)
celerybeat_1    |   File "/usr/local/lib/python3.6/dbm/__init__.py", line 94, in open
celerybeat_1    |     return mod.open(file, flag, mode)
celerybeat_1    | _gdbm.error: [Errno 22] Invalid argument
celerybeat_1    |
celerybeat_1    | During handling of the above exception, another exception occurred:
celerybeat_1    |
celerybeat_1    | Traceback (most recent call last):
celerybeat_1    |   File "/usr/local/lib/python3.6/site-packages/celery/apps/beat.py", line 109, in start_scheduler
celerybeat_1    |     service.start()
celerybeat_1    |   File "/usr/local/lib/python3.6/site-packages/celery/beat.py", line 579, in start
celerybeat_1    |     humanize_seconds(self.scheduler.max_interval))
celerybeat_1    |   File "/usr/local/lib/python3.6/site-packages/kombu/utils/objects.py", line 44, in __get__
celerybeat_1    |     value = obj.__dict__[self.__name__] = self.__get(obj)
celerybeat_1    |   File "/usr/local/lib/python3.6/site-packages/celery/beat.py", line 623, in scheduler
celerybeat_1    |     return self.get_scheduler()
celerybeat_1    |   File "/usr/local/lib/python3.6/site-packages/celery/beat.py", line 618, in get_scheduler
celerybeat_1    |     lazy=lazy,
celerybeat_1    |   File "/usr/local/lib/python3.6/site-packages/celery/beat.py", line 458, in __init__
celerybeat_1    |     Scheduler.__init__(self, *args, **kwargs)
celerybeat_1    |   File "/usr/local/lib/python3.6/site-packages/celery/beat.py", line 225, in __init__
celerybeat_1    |     self.setup_schedule()
celerybeat_1    |   File "/usr/local/lib/python3.6/site-packages/celery/beat.py", line 484, in setup_schedule
celerybeat_1    |     self._store = self._destroy_open_corrupted_schedule(exc)
celerybeat_1    |   File "/usr/local/lib/python3.6/site-packages/celery/beat.py", line 472, in _destroy_open_corrupted_schedule
celerybeat_1    |     return self._open_schedule()
celerybeat_1    |   File "/usr/local/lib/python3.6/site-packages/celery/beat.py", line 466, in _open_schedule
celerybeat_1    |     return self.persistence.open(self.schedule_filename, writeback=True)
celerybeat_1    |   File "/usr/local/lib/python3.6/shelve.py", line 243, in open
celerybeat_1    |     return DbfilenameShelf(filename, flag, protocol, writeback)
celerybeat_1    |   File "/usr/local/lib/python3.6/shelve.py", line 227, in __init__
celerybeat_1    |     Shelf.__init__(self, dbm.open(filename, flag), protocol, writeback)
celerybeat_1    |   File "/usr/local/lib/python3.6/dbm/__init__.py", line 94, in open
celerybeat_1    |     return mod.open(file, flag, mode)
celerybeat_1    | _gdbm.error: [Errno 22] Invalid argument
celerybeat_1    | [2018-09-07 21:29:50,023: WARNING/MainProcess] Traceback (most recent call last):
celerybeat_1    | [2018-09-07 21:29:50,025: WARNING/MainProcess] File "/usr/local/lib/python3.6/site-packages/kombu/utils/objects.py", line 42, in __get__
celerybeat_1    | [2018-09-07 21:29:50,027: WARNING/MainProcess] return obj.__dict__[self.__name__]
celerybeat_1    | [2018-09-07 21:29:50,027: WARNING/MainProcess] KeyError
celerybeat_1    | [2018-09-07 21:29:50,030: WARNING/MainProcess] :
celerybeat_1    | [2018-09-07 21:29:50,032: WARNING/MainProcess] 'scheduler'
celerybeat_1    | [2018-09-07 21:29:50,035: WARNING/MainProcess] During handling of the above exception, another exception occurred:
celerybeat_1    | [2018-09-07 21:29:50,035: WARNING/MainProcess] Traceback (most recent call last):
celerybeat_1    | [2018-09-07 21:29:50,035: WARNING/MainProcess] File "/usr/local/lib/python3.6/site-packages/celery/beat.py", line 476, in setup_schedule
celerybeat_1    | [2018-09-07 21:29:50,040: WARNING/MainProcess] self._store = self._open_schedule()
celerybeat_1    | [2018-09-07 21:29:50,042: WARNING/MainProcess] File "/usr/local/lib/python3.6/site-packages/celery/beat.py", line 466, in _open_schedule
celerybeat_1    | [2018-09-07 21:29:50,044: WARNING/MainProcess] return self.persistence.open(self.schedule_filename, writeback=True)
celerybeat_1    | [2018-09-07 21:29:50,054: WARNING/MainProcess] File "/usr/local/lib/python3.6/shelve.py", line 243, in open
celerybeat_1    | [2018-09-07 21:29:50,070: WARNING/MainProcess] return DbfilenameShelf(filename, flag, protocol, writeback)
celerybeat_1    | [2018-09-07 21:29:50,070: WARNING/MainProcess] File "/usr/local/lib/python3.6/shelve.py", line 227, in __init__
celerybeat_1    | [2018-09-07 21:29:50,072: WARNING/MainProcess] Shelf.__init__(self, dbm.open(filename, flag), protocol, writeback)
celerybeat_1    | [2018-09-07 21:29:50,073: WARNING/MainProcess] File "/usr/local/lib/python3.6/dbm/__init__.py", line 94, in open
celerybeat_1    | [2018-09-07 21:29:50,082: WARNING/MainProcess] return mod.open(file, flag, mode)
celerybeat_1    | [2018-09-07 21:29:50,085: WARNING/MainProcess] _gdbm
celerybeat_1    | [2018-09-07 21:29:50,086: WARNING/MainProcess] .
celerybeat_1    | [2018-09-07 21:29:50,087: WARNING/MainProcess] error
celerybeat_1    | [2018-09-07 21:29:50,088: WARNING/MainProcess] :
celerybeat_1    | [2018-09-07 21:29:50,090: WARNING/MainProcess] [Errno 22] Invalid argument
celerybeat_1    | [2018-09-07 21:29:50,091: WARNING/MainProcess] During handling of the above exception, another exception occurred:
celerybeat_1    | [2018-09-07 21:29:50,093: WARNING/MainProcess] Traceback (most recent call last):
celerybeat_1    | [2018-09-07 21:29:50,095: WARNING/MainProcess] File "/usr/local/bin/celery", line 11, in <module>
celerybeat_1    | [2018-09-07 21:29:50,098: WARNING/MainProcess] sys.exit(main())
celerybeat_1    | [2018-09-07 21:29:50,101: WARNING/MainProcess] File "/usr/local/lib/python3.6/site-packages/celery/__main__.py", line 16, in main
celerybeat_1    | [2018-09-07 21:29:50,102: WARNING/MainProcess] _main()
celerybeat_1    | [2018-09-07 21:29:50,103: WARNING/MainProcess] File "/usr/local/lib/python3.6/site-packages/celery/bin/celery.py", line 322, in main
celerybeat_1    | [2018-09-07 21:29:50,105: WARNING/MainProcess] cmd.execute_from_commandline(argv)
celerybeat_1    | [2018-09-07 21:29:50,109: WARNING/MainProcess] File "/usr/local/lib/python3.6/site-packages/celery/bin/celery.py", line 496, in execute_from_commandline
celerybeat_1    | [2018-09-07 21:29:50,110: WARNING/MainProcess] super(CeleryCommand, self).execute_from_commandline(argv)))
celerybeat_1    | [2018-09-07 21:29:50,114: WARNING/MainProcess] File "/usr/local/lib/python3.6/site-packages/celery/bin/base.py", line 275, in execute_from_commandline
celerybeat_1    | [2018-09-07 21:29:50,117: WARNING/MainProcess] return self.handle_argv(self.prog_name, argv[1:])
celerybeat_1    | [2018-09-07 21:29:50,118: WARNING/MainProcess] File "/usr/local/lib/python3.6/site-packages/celery/bin/celery.py", line 488, in handle_argv
celerybeat_1    | [2018-09-07 21:29:50,120: WARNING/MainProcess] return self.execute(command, argv)
celerybeat_1    | [2018-09-07 21:29:50,123: WARNING/MainProcess] File "/usr/local/lib/python3.6/site-packages/celery/bin/celery.py", line 420, in execute
celerybeat_1    | [2018-09-07 21:29:50,130: WARNING/MainProcess] ).run_from_argv(self.prog_name, argv[1:], command=argv[0])
celerybeat_1    | [2018-09-07 21:29:50,132: WARNING/MainProcess] File "/usr/local/lib/python3.6/site-packages/celery/bin/base.py", line 279, in run_from_argv
celerybeat_1    | [2018-09-07 21:29:50,134: WARNING/MainProcess] sys.argv if argv is None else argv, command)
celerybeat_1    | [2018-09-07 21:29:50,136: WARNING/MainProcess] File "/usr/local/lib/python3.6/site-packages/celery/bin/base.py", line 363, in handle_argv
celerybeat_1    | [2018-09-07 21:29:50,138: WARNING/MainProcess] return self(*args, **options)
celerybeat_1    | [2018-09-07 21:29:50,141: WARNING/MainProcess] File "/usr/local/lib/python3.6/site-packages/celery/bin/base.py", line 238, in __call__
celerybeat_1    | [2018-09-07 21:29:50,142: WARNING/MainProcess] ret = self.run(*args, **kwargs)
celerybeat_1    | [2018-09-07 21:29:50,146: WARNING/MainProcess] File "/usr/local/lib/python3.6/site-packages/celery/bin/beat.py", line 109, in run
celerybeat_1    | [2018-09-07 21:29:50,154: WARNING/MainProcess] return beat().run()
celerybeat_1    | [2018-09-07 21:29:50,156: WARNING/MainProcess] File "/usr/local/lib/python3.6/site-packages/celery/apps/beat.py", line 81, in run
celerybeat_1    | [2018-09-07 21:29:50,157: WARNING/MainProcess] self.start_scheduler()
celerybeat_1    | [2018-09-07 21:29:50,166: WARNING/MainProcess] File "/usr/local/lib/python3.6/site-packages/celery/apps/beat.py", line 109, in start_scheduler
celerybeat_1    | [2018-09-07 21:29:50,168: WARNING/MainProcess] service.start()
celerybeat_1    | [2018-09-07 21:29:50,169: WARNING/MainProcess] File "/usr/local/lib/python3.6/site-packages/celery/beat.py", line 579, in start
celerybeat_1    | [2018-09-07 21:29:50,171: WARNING/MainProcess] humanize_seconds(self.scheduler.max_interval))
celerybeat_1    | [2018-09-07 21:29:50,172: WARNING/MainProcess] File "/usr/local/lib/python3.6/site-packages/kombu/utils/objects.py", line 44, in __get__
celerybeat_1    | [2018-09-07 21:29:50,174: WARNING/MainProcess] value = obj.__dict__[self.__name__] = self.__get(obj)
celerybeat_1    | [2018-09-07 21:29:50,176: WARNING/MainProcess] File "/usr/local/lib/python3.6/site-packages/celery/beat.py", line 623, in scheduler
celerybeat_1    | [2018-09-07 21:29:50,182: WARNING/MainProcess] return self.get_scheduler()
celerybeat_1    | [2018-09-07 21:29:50,183: WARNING/MainProcess] File "/usr/local/lib/python3.6/site-packages/celery/beat.py", line 618, in get_scheduler
celerybeat_1    | [2018-09-07 21:29:50,184: WARNING/MainProcess] lazy=lazy,
celerybeat_1    | [2018-09-07 21:29:50,189: WARNING/MainProcess] File "/usr/local/lib/python3.6/site-packages/celery/beat.py", line 458, in __init__
celerybeat_1    | [2018-09-07 21:29:50,190: WARNING/MainProcess] Scheduler.__init__(self, *args, **kwargs)
celerybeat_1    | [2018-09-07 21:29:50,191: WARNING/MainProcess] File "/usr/local/lib/python3.6/site-packages/celery/beat.py", line 225, in __init__
celerybeat_1    | [2018-09-07 21:29:50,192: WARNING/MainProcess] self.setup_schedule()
celerybeat_1    | [2018-09-07 21:29:50,193: WARNING/MainProcess] File "/usr/local/lib/python3.6/site-packages/celery/beat.py", line 484, in setup_schedule
celerybeat_1    | [2018-09-07 21:29:50,195: WARNING/MainProcess] self._store = self._destroy_open_corrupted_schedule(exc)
celerybeat_1    | [2018-09-07 21:29:50,196: WARNING/MainProcess] File "/usr/local/lib/python3.6/site-packages/celery/beat.py", line 472, in _destroy_open_corrupted_schedule
celerybeat_1    | [2018-09-07 21:29:50,198: WARNING/MainProcess] return self._open_schedule()
celerybeat_1    | [2018-09-07 21:29:50,200: WARNING/MainProcess] File "/usr/local/lib/python3.6/site-packages/celery/beat.py", line 466, in _open_schedule
celerybeat_1    | [2018-09-07 21:29:50,203: WARNING/MainProcess] return self.persistence.open(self.schedule_filename, writeback=True)
celerybeat_1    | [2018-09-07 21:29:50,212: WARNING/MainProcess] File "/usr/local/lib/python3.6/shelve.py", line 243, in open
celerybeat_1    | [2018-09-07 21:29:50,214: WARNING/MainProcess] return DbfilenameShelf(filename, flag, protocol, writeback)
celerybeat_1    | [2018-09-07 21:29:50,219: WARNING/MainProcess] File "/usr/local/lib/python3.6/shelve.py", line 227, in __init__
celerybeat_1    | [2018-09-07 21:29:50,221: WARNING/MainProcess] Shelf.__init__(self, dbm.open(filename, flag), protocol, writeback)
celerybeat_1    | [2018-09-07 21:29:50,222: WARNING/MainProcess] File "/usr/local/lib/python3.6/dbm/__init__.py", line 94, in open
celerybeat_1    | [2018-09-07 21:29:50,223: WARNING/MainProcess] return mod.open(file, flag, mode)
celerybeat_1    | [2018-09-07 21:29:50,224: WARNING/MainProcess] _gdbm
celerybeat_1    | [2018-09-07 21:29:50,224: WARNING/MainProcess] .
celerybeat_1    | [2018-09-07 21:29:50,226: WARNING/MainProcess] error
celerybeat_1    | [2018-09-07 21:29:50,227: WARNING/MainProcess] :
celerybeat_1    | [2018-09-07 21:29:50,233: WARNING/MainProcess] [Errno 22] Invalid argument
testcelery_celerybeat_1 exited with code 1

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

11reactions
xgenvncommented, Dec 9, 2018

@Hey-tom @maro99

Add django_celery_beat==1.3.0 # https://github.com/celery/django-celery-beat to your base.txt

And change compose/local/django/celery/beat/start:

rm -f './celerybeat.pid'
celery -A apps.taskapp beat -l INFO --scheduler django_celery_beat.schedulers:DatabaseScheduler

Then docker-compose -f local.yml up --build again.

This change will set Celery to use Django scheduler database backend.

5reactions
maro99commented, Dec 8, 2018

help…killl me…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Celerybeat container fails to start · Issue #1793 - GitHub
The celerybeat container should start successfully. Steps to reproduce. Project generation options (all default, except enable docker and celery).
Read more >
celery beat container gets stuck - docker - Stack Overflow
I started running a celery beat worker in a dedicated container. This works fine sometimes, but now I get the following error trying...
Read more >
How to build django web app container BEFORE celery and ...
When I build and run my containers, I have errors with celery and celery-beat when migrate django database Looks like migrations are applyed ......
Read more >
Docker Compose, stray PID files, Rails and beyond
ERROR: Pidfile (celerybeat.pid) already exists. A server is already running. ... To run this container, we first need to build its image:.
Read more >
When using docker-compose deployment, the celerybeat ...
When using the docker-compose.yml from 0.20.1, the celerybeat container may fail to restart after a clean exit, repeating the following log ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found