Checklist
- [ ] I have verified that the issue exists against the
main
branch of Celery.
- [ ] This has already been asked to the discussions forum first.
- [x] I have read the relevant section in the
contribution guide
on reporting bugs.
- [x] I have checked the issues list
for similar or identical bug reports.
- [x] I have checked the pull requests list
for existing proposed fixes.
- [ ] I have checked the commit log
to find out if the bug was already fixed in the main branch.
- [x] I have included all related issues and possible duplicate issues
in this issue (If there are none, check this box anyway).
Mandatory Debugging Information
- [x] I have included the output of
celery -A proj report
in the issue.
(if you are not able to do this, then at least specify the Celery
version affected).
- [ ] I have verified that the issue exists against the
main
branch of Celery.
- [x] I have included the contents of
pip freeze
in the issue.
- [ ] I have included all the versions of all the external dependencies required
to reproduce this bug.
Optional Debugging Information
- [x] I have tried reproducing the issue on more than one Python version
and/or implementation.
- [ ] I have tried reproducing the issue on more than one message broker and/or
result backend.
- [x] I have tried reproducing the issue on more than one version of the message
broker and/or result backend.
- [ ] I have tried reproducing the issue on more than one operating system.
- [ ] I have tried reproducing the issue on more than one workers pool.
- [ ] I have tried reproducing the issue with autoscaling, retries,
ETA/Countdown & rate limits disabled.
- [x] I have tried reproducing the issue after downgrading
and/or upgrading Celery and its dependencies.
Related Issues and Possible Duplicates
Related Issues
Possible Duplicates
Environment & Settings
Celery version:
celery report
Output:
<unknown>:1: DeprecationWarning: invalid escape sequence \.
<unknown>:1: DeprecationWarning: invalid escape sequence \:
<unknown>:1: DeprecationWarning: invalid escape sequence \.
<unknown>:1: DeprecationWarning: invalid escape sequence \:
/usr/local/lib/python3.9/dist-packages/celery/utils/collections.py:163: RemovedInDjango40Warning: The PASSWORD_RESET_TIMEOUT_DAYS setting is deprecated. Use PASSWORD_RESET_TIMEOUT instead.
return getattr(self.obj, key)
software -> celery:5.2.7 (dawn-chorus) kombu:5.2.4 py:3.9.2
billiard:3.6.4.0 py-amqp:5.1.1
platform -> system:Linux arch:64bit
kernel version:5.10.16.3-microsoft-standard-WSL2 imp:CPython
loader -> celery.loaders.app.AppLoader
settings -> transport:pyamqp results:redis://redis/
ABSOLUTE_URL_OVERRIDES: {
}
ADMINS: []
ALLOWED_HOSTS: ['localhost',
'127.0.0.1',
'::1',
'host.docker.internal',
'10.0.2.2',
'172.17.0.1']
APPEND_SLASH: True
AUTHENTICATION_BACKENDS: ['django.contrib.auth.backends.ModelBackend']
AUTH_PASSWORD_VALIDATORS: '********'
AUTH_USER_MODEL: 'auth.User'
BASE_DIR: '/usr/src/app'
CACHES: {
'default': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'}}
CACHE_MIDDLEWARE_ALIAS: 'default'
CACHE_MIDDLEWARE_KEY_PREFIX: '********'
CACHE_MIDDLEWARE_SECONDS: 600
CELERY_ACCEPT_CONTENT: ['customjson']
CELERY_BROKER_URL: 'amqp://guest:********@rabbitmq:5672//'
CELERY_ENABLE_UTC: True
CELERY_RESULT_BACKEND: 'redis://redis/'
CELERY_RESULT_SERIALIZER: 'customjson'
CELERY_TASK_SERIALIZER: 'customjson'
CELERY_TIMEZONE: 'Europe/Amsterdam'
<private>
CRON_CLASSES: ['geocatalog.cron.UpdateCswTables']
CSRF_COOKIE_AGE: 31449600
CSRF_COOKIE_DOMAIN: None
CSRF_COOKIE_HTTPONLY: False
CSRF_COOKIE_NAME: 'csrftoken'
CSRF_COOKIE_PATH: '/'
CSRF_COOKIE_SAMESITE: 'Lax'
CSRF_COOKIE_SECURE: False
CSRF_FAILURE_VIEW: 'django.views.csrf.csrf_failure'
CSRF_HEADER_NAME: 'HTTP_X_CSRFTOKEN'
CSRF_TRUSTED_ORIGINS: []
CSRF_USE_SESSIONS: False
DATABASES: {
'default': { 'ATOMIC_REQUESTS': False,
'AUTOCOMMIT': True,
'CONN_MAX_AGE': 0,
'ENGINE': 'django.db.backends.postgresql',
'HOST': 'host.docker.internal',
'NAME': 'osmgmt',
'OPTIONS': {},
'PASSWORD': '********',
'PORT': '5432',
'TEST': { 'CHARSET': None,
'COLLATION': None,
'MIGRATE': True,
'MIRROR': None,
'NAME': None},
'TIME_ZONE': None,
'USER': 'django'}}
DATABASE_ROUTERS: '********'
<private>
DATA_UPLOAD_MAX_MEMORY_SIZE: 2621440
DATA_UPLOAD_MAX_NUMBER_FIELDS: 1000
DATETIME_FORMAT: 'N j, Y, P'
DATETIME_INPUT_FORMATS: ['%Y-%m-%d %H:%M:%S',
'%Y-%m-%d %H:%M:%S.%f',
'%Y-%m-%d %H:%M',
'%m/%d/%Y %H:%M:%S',
'%m/%d/%Y %H:%M:%S.%f',
'%m/%d/%Y %H:%M',
'%m/%d/%y %H:%M:%S',
'%m/%d/%y %H:%M:%S.%f',
'%m/%d/%y %H:%M']
DATE_FORMAT: 'N j, Y'
DATE_INPUT_FORMATS: ['%Y-%m-%d',
'%m/%d/%Y',
'%m/%d/%y',
'%b %d %Y',
'%b %d, %Y',
'%d %b %Y',
'%d %b, %Y',
'%B %d %Y',
'%B %d, %Y',
'%d %B %Y',
'%d %B, %Y']
DEBUG: 1
DEBUG_PROPAGATE_EXCEPTIONS: False
DECIMAL_SEPARATOR: '.'
DEFAULT_AUTO_FIELD: 'django.db.models.AutoField'
DEFAULT_CHARSET: 'utf-8'
DEFAULT_EXCEPTION_REPORTER: 'django.views.debug.ExceptionReporter'
DEFAULT_EXCEPTION_REPORTER_FILTER: 'django.views.debug.SafeExceptionReporterFilter'
DEFAULT_FILE_STORAGE: 'django.core.files.storage.FileSystemStorage'
<private>
DEFAULT_HASHING_ALGORITHM: 'sha256'
DEFAULT_INDEX_TABLESPACE: ''
DEFAULT_TABLESPACE: ''
DISALLOWED_USER_AGENTS: []
EMAIL_BACKEND: 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST: 'mailhost.domain.com'
EMAIL_HOST_PASSWORD: '********'
EMAIL_HOST_USER: '[email protected]'
EMAIL_PORT: '465'
EMAIL_SSL_CERTFILE: None
EMAIL_SSL_KEYFILE: '********'
EMAIL_SUBJECT_PREFIX: '[Django] '
EMAIL_TIMEOUT: None
EMAIL_USE_LOCALTIME: False
EMAIL_USE_SSL: 'True'
EMAIL_USE_TLS: False
<private>
FILE_UPLOAD_DIRECTORY_PERMISSIONS: None
FILE_UPLOAD_HANDLERS: ['django.core.files.uploadhandler.MemoryFileUploadHandler',
'django.core.files.uploadhandler.TemporaryFileUploadHandler']
FILE_UPLOAD_MAX_MEMORY_SIZE: 2621440
FILE_UPLOAD_PERMISSIONS: 420
FILE_UPLOAD_TEMP_DIR: None
FIRST_DAY_OF_WEEK: 0
FIXTURE_DIRS: []
FORCE_SCRIPT_NAME: None
FORMAT_MODULE_PATH: None
FORM_RENDERER: 'django.forms.renderers.DjangoTemplates'
<private>
IGNORABLE_404_URLS: []
INSTALLED_APPS: ['config.apps.ConfigConfig',
'dataupload.apps.DatauploadConfig',
'gds.apps.GdsConfig',
'mapcomposer.apps.MapcomposerConfig',
'workflow.apps.WorkflowConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django_cron',
'polymorphic',
'rest_framework',
'taggit']
INTERNAL_IPS: []
<private>
LANGUAGES: [('af', 'Afrikaans'),
('ar', 'Arabic'),
('ar-dz', 'Algerian Arabic'),
('ast', 'Asturian'),
('az', 'Azerbaijani'),
('bg', 'Bulgarian'),
('be', 'Belarusian'),
('bn', 'Bengali'),
('br', 'Breton'),
('bs', 'Bosnian'),
('ca', 'Catalan'),
('cs', 'Czech'),
('cy', 'Welsh'),
('da', 'Danish'),
('de', 'German'),
('dsb', 'Lower Sorbian'),
('el', 'Greek'),
('en', 'English'),
('en-au', 'Australian English'),
('en-gb', 'British English'),
('eo', 'Esperanto'),
('es', 'Spanish'),
('es-ar', 'Argentinian Spanish'),
('es-co', 'Colombian Spanish'),
('es-mx', 'Mexican Spanish'),
('es-ni', 'Nicaraguan Spanish'),
('es-ve', 'Venezuelan Spanish'),
('et', 'Estonian'),
('eu', 'Basque'),
('fa', 'Persian'),
('fi', 'Finnish'),
('fr', 'French'),
('fy', 'Frisian'),
('ga', 'Irish'),
('gd', 'Scottish Gaelic'),
('gl', 'Galician'),
('he', 'Hebrew'),
('hi', 'Hindi'),
('hr', 'Croatian'),
('hsb', 'Upper Sorbian'),
('hu', 'Hungarian'),
('hy', 'Armenian'),
('ia', 'Interlingua'),
('id', 'Indonesian'),
('ig', 'Igbo'),
('io', 'Ido'),
('is', 'Icelandic'),
('it', 'Italian'),
('ja', 'Japanese'),
('ka', 'Georgian'),
('kab', 'Kabyle'),
('kk', 'Kazakh'),
('km', 'Khmer'),
('kn', 'Kannada'),
('ko', 'Korean'),
('ky', 'Kyrgyz'),
('lb', 'Luxembourgish'),
('lt', 'Lithuanian'),
('lv', 'Latvian'),
('mk', 'Macedonian'),
('ml', 'Malayalam'),
('mn', 'Mongolian'),
('mr', 'Marathi'),
('my', 'Burmese'),
('nb', 'Norwegian Bokmål'),
('ne', 'Nepali'),
('nl', 'Dutch'),
('nn', 'Norwegian Nynorsk'),
('os', 'Ossetic'),
('pa', 'Punjabi'),
('pl', 'Polish'),
('pt', 'Portuguese'),
('pt-br', 'Brazilian Portuguese'),
('ro', 'Romanian'),
('ru', 'Russian'),
('sk', 'Slovak'),
('sl', 'Slovenian'),
('sq', 'Albanian'),
('sr', 'Serbian'),
('sr-latn', 'Serbian Latin'),
('sv', 'Swedish'),
('sw', 'Swahili'),
('ta', 'Tamil'),
('te', 'Telugu'),
('tg', 'Tajik'),
('th', 'Thai'),
('tk', 'Turkmen'),
('tr', 'Turkish'),
('tt', 'Tatar'),
('udm', 'Udmurt'),
('uk', 'Ukrainian'),
('ur', 'Urdu'),
('uz', 'Uzbek'),
('vi', 'Vietnamese'),
('zh-hans', 'Simplified Chinese'),
('zh-hant', 'Traditional Chinese')]
LANGUAGES_BIDI: ['he', 'ar', 'ar-dz', 'fa', 'ur']
LANGUAGE_CODE: 'nl-nl'
LANGUAGE_COOKIE_AGE: None
LANGUAGE_COOKIE_DOMAIN: None
LANGUAGE_COOKIE_HTTPONLY: False
LANGUAGE_COOKIE_NAME: 'django_language'
LANGUAGE_COOKIE_PATH: '/'
LANGUAGE_COOKIE_SAMESITE: None
LANGUAGE_COOKIE_SECURE: False
LOCALE_PATHS: []
LOGGING: {
'disable_existing_loggers': False,
'formatters': { 'verbose': { 'format': '{asctime} - {module} - '
'{levelname} - {message}',
'style': '{'}},
'handlers': { 'console': { 'class': 'logging.StreamHandler',
'formatter': 'verbose'}},
'loggers': { 'etl': { 'handlers': ['console'],
'level': 'INFO',
'propagate': False}},
'version': 1}
LOGGING_CONFIG: 'logging.config.dictConfig'
LOGIN_REDIRECT_URL: '/'
LOGIN_URL: '/accounts/login/'
LOGOUT_REDIRECT_URL: None
MANAGERS: []
MEDIA_ROOT: '/media'
MEDIA_URL: '/'
MESSAGE_STORAGE: 'django.contrib.messages.storage.fallback.FallbackStorage'
MIDDLEWARE: ['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']
MIGRATION_MODULES: {
}
MONTH_DAY_FORMAT: 'F j'
NUMBER_GROUPING: 0
<private>
PASSWORD_HASHERS: '********'
PASSWORD_RESET_TIMEOUT: '********'
PASSWORD_RESET_TIMEOUT_DAYS: '********'
PREPEND_WWW: False
REST_FRAMEWORK: {
'DEFAULT_AUTHENTICATION_CLASSES': [ 'rest_framework.authentication.SessionAuthentication',
'rest_framework.authentication.BasicAuthentication',
'rest_framework_simplejwt.authentication.JWTAuthentication'],
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
'DEFAULT_PERMISSION_CLASSES': [ 'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly'],
'PAGE_SIZE': 10}
ROOT_URLCONF: 'osmgmt.urls'
SECRET_KEY: '********'
SECURE_BROWSER_XSS_FILTER: False
SECURE_CONTENT_TYPE_NOSNIFF: True
SECURE_HSTS_INCLUDE_SUBDOMAINS: False
SECURE_HSTS_PRELOAD: False
SECURE_HSTS_SECONDS: 0
SECURE_PROXY_SSL_HEADER:
('HTTP_X_FORWARDED_PROTO', 'https')
SECURE_REDIRECT_EXEMPT: []
SECURE_REFERRER_POLICY: 'same-origin'
SECURE_SSL_HOST: None
SECURE_SSL_REDIRECT: False
SERVER_EMAIL: '[email protected]'
SESSION_CACHE_ALIAS: 'default'
SESSION_COOKIE_AGE: 1800
SESSION_COOKIE_DOMAIN: None
SESSION_COOKIE_HTTPONLY: True
SESSION_COOKIE_NAME: 'sessionid'
SESSION_COOKIE_PATH: '/'
SESSION_COOKIE_SAMESITE: 'Lax'
SESSION_COOKIE_SECURE: False
SESSION_ENGINE: 'django.contrib.sessions.backends.db'
SESSION_EXPIRE_AT_BROWSER_CLOSE: False
SESSION_FILE_PATH: None
SESSION_SAVE_EVERY_REQUEST: True
SESSION_SERIALIZER: 'django.contrib.sessions.serializers.JSONSerializer'
SETTINGS_MODULE: 'osmgmt.settings'
SHORT_DATETIME_FORMAT: 'm/d/Y P'
SHORT_DATE_FORMAT: 'm/d/Y'
SIGNING_BACKEND: 'django.core.signing.TimestampSigner'
SILENCED_SYSTEM_CHECKS: []
SIMPLE_JWT: {
'ACCESS_TOKEN_LIFETIME': '********',
'TOKEN_TYPE_CLAIM': '********',
'USER_ID_CLAIM': 'user',
'USER_ID_FIELD': 'username'}
STATICFILES_DIRS: ['/usr/src/app/static',
'/usr/src/app/dataupload/static']
STATICFILES_FINDERS: ['django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder']
STATICFILES_STORAGE: 'django.contrib.staticfiles.storage.StaticFilesStorage'
STATIC_ROOT: '/usr/src/app/allstaticfiles'
STATIC_URL: '/static/'
TEMPLATES: [{'APP_DIRS': True,
'BACKEND': 'django.template.backends.jinja2.Jinja2',
'DIRS': [],
'OPTIONS': {'environment': 'osmgmt.jinja2.environment'}},
{'APP_DIRS': True,
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': ['/usr/src/app/templates'],
'OPTIONS': {'context_processors': ['django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages']}}]
TEST_NON_SERIALIZED_APPS: []
TEST_RUNNER: 'django.test.runner.DiscoverRunner'
THOUSAND_SEPARATOR: ','
TIME_FORMAT: 'P'
TIME_INPUT_FORMATS: ['%H:%M:%S', '%H:%M:%S.%f', '%H:%M']
TIME_ZONE: 'Europe/Amsterdam'
USE_I18N: True
USE_L10N: True
USE_THOUSAND_SEPARATOR: True
USE_TZ: False
USE_X_FORWARDED_HOST: True
USE_X_FORWARDED_PORT: False
WSGI_APPLICATION: 'osmgmt.wsgi.application'
X_FRAME_OPTIONS: 'DENY'
YEAR_MONTH_FORMAT: 'F Y'
is_overridden: <bound method Settings.is_overridden of <Settings "osmgmt.settings">>
deprecated_settings: None
Steps to Reproduce
Required Dependencies
- Minimal Python Version: N/A or Unknown
- Minimal Celery Version: N/A or Unknown
- Minimal Kombu Version: N/A or Unknown
- Minimal Broker Version: N/A or Unknown
- Minimal Result Backend Version: N/A or Unknown
- Minimal OS and/or Kernel Version: N/A or Unknown
- Minimal Broker Client Version: N/A or Unknown
- Minimal Result Backend Client Version: N/A or Unknown
Python Packages
pip freeze
Output:
amqp==5.1.1
anyjson==0.3.3
asgiref==3.6.0
async-timeout==4.0.2
attrs==22.2.0
bcrypt==4.0.1
billiard==3.6.4.0
celery==5.2.7
certifi==2022.12.7
cffi==1.15.1
charset-normalizer==2.0.12
click==8.1.3
click-didyoumean==0.0.3
click-plugins==1.1.1
click-repl==0.2.0
cligj==0.7.2
colorama==0.4.4
contourpy==1.0.6
cryptography==39.0.0
cycler==0.11.0
defusedxml==0.7.1
Django==3.2.12
django-cron==0.6.0
django-polymorphic==3.1.0
django-taggit==3.1.0
djangorestframework==3.14.0
djangorestframework-simplejwt==5.2.2
ephem==3.7.7.1
Fiona==1.8.22
flower==1.2.0
fonttools==4.38.0
fpdf2==2.6.0
geolinks==0.2.0
geopandas==0.12.2
greenlet==2.0.1
humanize==4.4.0
idna==3.4
Jinja2==3.1.2
jsonschema==4.17.3
kiwisolver==1.4.4
kombu==5.2.4
lxml==4.9.2
MarkupSafe==2.1.1
matplotlib==3.6.2
munch==2.5.0
numpy==1.24.1
OWSLib==0.27.2
packaging==22.0
pandas==1.5.2
paramiko==2.12.0
parsimonious==0.10.0
Pillow==9.4.0
prometheus-client==0.15.0
prompt-toolkit==3.0.14
psycopg2-binary==2.9.5
pycparser==2.21
pycsw==2.6.1
Pygments==2.14.0
PyJWT==2.6.0
PyNaCl==1.5.0
pyparsing==2.4.7
PyPDF2==2.11.2
pyproj==3.4.1
pyrsistent==0.19.3
python-dateutil==2.8.1
python-memcached==1.58
pytz==2022.7
PyYAML==6.0
redis==4.4.0
regex==2022.10.31
requests==2.28.1
scp==0.14.4
Shapely==1.8.5.post1
six==1.16.0
SQLAlchemy==1.4.45
sqlparse==0.4.3
tornado==6.2
typing_extensions==4.4.0
Unidecode==1.3.6
urllib3==1.26.13
vine==5.0.0
wcwidth==0.1.9
xmltodict==0.13.0
Other Dependencies
OS: Linux Debian Buster - Bullseye (in Docker on Windows)
Python 3.7 - 3.9
Django: 3.2.12
Celery 5.0.5 - 5.2.7
Kombu 5.0.2 - 5.2.4
librabbitmq 2.0.0 or amqp 5.1.1
Minimally Reproducible Test Case
Expected Behavior
The task submitted to the broker is being processed happily by Celery.
Actual Behavior
The following error occurs:
celery_1 | [2023-01-03 16:58:29,653: CRITICAL/MainProcess] Unrecoverable error: AttributeError('int')
celery_1 | Traceback (most recent call last):
celery_1 | File "/usr/local/lib/python3.9/dist-packages/celery/worker/worker.py", line 203, in start
celery_1 | self.blueprint.start(self)
celery_1 | File "/usr/local/lib/python3.9/dist-packages/celery/bootsteps.py", line 116, in start
celery_1 | step.start(parent)
celery_1 | File "/usr/local/lib/python3.9/dist-packages/celery/bootsteps.py", line 365, in start
celery_1 | return self.obj.start()
celery_1 | File "/usr/local/lib/python3.9/dist-packages/celery/worker/consumer/consumer.py", line 332, in start
celery_1 | blueprint.start(self)
celery_1 | File "/usr/local/lib/python3.9/dist-packages/celery/bootsteps.py", line 116, in start
celery_1 | step.start(parent)
celery_1 | File "/usr/local/lib/python3.9/dist-packages/celery/worker/consumer/consumer.py", line 628, in start
celery_1 | c.loop(*c.loop_args())
celery_1 | File "/usr/local/lib/python3.9/dist-packages/celery/worker/loops.py", line 97, in asynloop
celery_1 | next(loop)
celery_1 | File "/usr/local/lib/python3.9/dist-packages/kombu/asynchronous/hub.py", line 362, in create_loop
celery_1 | cb(*cbargs)
celery_1 | File "/usr/local/lib/python3.9/dist-packages/kombu/transport/base.py", line 235, in on_readable
celery_1 | reader(loop)
celery_1 | File "/usr/local/lib/python3.9/dist-packages/kombu/transport/base.py", line 217, in _read
celery_1 | drain_events(timeout=0)
celery_1 | File "/usr/local/lib/python3.9/dist-packages/amqp/connection.py", line 525, in drain_events
celery_1 | while not self.blocking_read(timeout):
celery_1 | File "/usr/local/lib/python3.9/dist-packages/amqp/connection.py", line 531, in blocking_read
celery_1 | return self.on_inbound_frame(frame)
celery_1 | File "/usr/local/lib/python3.9/dist-packages/amqp/method_framing.py", line 77, in on_frame
celery_1 | callback(channel, msg.frame_method, msg.frame_args, msg)
celery_1 | File "/usr/local/lib/python3.9/dist-packages/amqp/connection.py", line 537, in on_inbound_method
celery_1 | return self.channels[channel_id].dispatch_method(
celery_1 | File "/usr/local/lib/python3.9/dist-packages/amqp/abstract_channel.py", line 156, in dispatch_method
celery_1 | listener(*args)
celery_1 | File "/usr/local/lib/python3.9/dist-packages/amqp/channel.py", line 1629, in _on_basic_deliver
celery_1 | fun(msg)
celery_1 | File "/usr/local/lib/python3.9/dist-packages/kombu/messaging.py", line 626, in _receive_callback
celery_1 | return on_m(message) if on_m else self.receive(decoded, message)
celery_1 | File "/usr/local/lib/python3.9/dist-packages/celery/worker/consumer/consumer.py", line 596, in on_task_received
celery_1 | strategy(
celery_1 | File "/usr/local/lib/python3.9/dist-packages/celery/worker/strategy.py", line 207, in task_message_handler
celery_1 | handle(req)
celery_1 | File "/usr/local/lib/python3.9/dist-packages/celery/worker/worker.py", line 221, in _process_task_sem
celery_1 | return self._quick_acquire(self._process_task, req)
celery_1 | File "/usr/local/lib/python3.9/dist-packages/kombu/asynchronous/semaphore.py", line 54, in acquire
celery_1 | callback(*partial_args, **partial_kwargs)
celery_1 | File "/usr/local/lib/python3.9/dist-packages/celery/worker/worker.py", line 226, in _process_task
celery_1 | req.execute_using_pool(self.pool)
celery_1 | File "/usr/local/lib/python3.9/dist-packages/celery/worker/request.py", line 707, in execute_using_pool
celery_1 | result = apply_async(
celery_1 | File "/usr/local/lib/python3.9/dist-packages/celery/concurrency/base.py", line 152, in apply_async
celery_1 | return self.on_apply(target, args, kwargs,
celery_1 | File "/usr/local/lib/python3.9/dist-packages/billiard/pool.py", line 1530, in apply_async
celery_1 | self._quick_put((TASK, (result._job, None, func, args, kwds)))
celery_1 | File "/usr/local/lib/python3.9/dist-packages/celery/concurrency/asynpool.py", line 866, in send_job
celery_1 | body = dumps(tup, protocol=protocol)
celery_1 | File "/usr/lib/python3.9/uuid.py", line 225, in __getstate__
celery_1 | d = {'int': self.int}
celery_1 | AttributeError: int
This happens after a task has been placed in RabbitMQ (broker) by Django, and is about to be handled by my worker (celery_1 container). The task is using the Celery canvas.
In Python 3.7 the actual error is a bit different, but it also occurs in the __getstate__
method in uuid.py. At that time I was able to patch this error by using my own version of uuid.py. I've added the check self.is_safe is not None
. Relevant part:
def __getstate__(self):
state = self.__dict__.copy()
if self.is_safe != SafeUUID.unknown:
# is_safe is a SafeUUID instance. Return just its value, so that
# it can be un-pickled in older Python versions without SafeUUID.
state['is_safe'] = self.is_safe.value
else:
# omit is_safe when it is "unknown"
del state['is_safe']
return state
After this everything seemed to proceed as normal.
Python 3.9 code for reference where this error occurs (see stack trace):
def __getstate__(self):
d = {'int': self.int}
if self.is_safe != SafeUUID.unknown:
# is_safe is a SafeUUID instance. Return just its value, so that
# it can be un-pickled in older Python versions without SafeUUID.
d['is_safe'] = self.is_safe.value
return d
The file uuid.py in my container is identical to the one here: https://github.com/python/cpython/blob/3.9/Lib/uuid.py
However, now it is time to use Python 3.9 (provided by Debian Bullseye), and I'm not able to work around this issue by fiddling with uuid.py. When I added a fix to the missing 'int' attribute (for example by setting it to 0), a similar error occurs somewhere else. I haven't tried patching uuid.py all over the place. Since this issue is occurring with multiple Celery versions and two different Python versions, I finally took the time to submit the bug report.
I have no clue what this causes, since the stack trace is very deep, but I assume this is related to serialization / deserialization of the message ID (which is a UUID). It seems to me that the __init__
method is never called when the UUID object is created. I could verify this by adding print statements to uuid.py in both the __init__
method and the __getstate__
method. The print statement in the __getstate__
method reported a different ID (print(id(self))
) than any of the ID's printed in __init__
.
I've tried to mitigate this issue by using Celery versions 5.0.5 - 5.2.7 (originally I was using 5.2.3). I've also switched from librabbitmq to the amqp Python lib. I've also tried to use Kombu 5.0.2 (together with Celery 5.0.5).
It is possible that this is actually caused by an issue in Kombu or Billiard.
Issue Type: Bug Report