kombu
kombu copied to clipboard
kombu.connection give a message: "No hostname was supplied. Reverting to default 'localhost'"
#bug It seems to happen every time I queue a celery task (i.e.: `my_task.delay() from a celery task. As brocker i using redis my config:
celery[redis]==5.2.7
kombu==5.2.4
django==4.1.5
upgraded from
celery[redis]==5.1.2
kombu==5.1.0
Django=3.1.5
p.s downgrade of celery and kombu dont help
# celeryapp.py
from celery import Celery
from coverage.annotate import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings.local')
app = Celery('engine_shop')
app.config_from_object('django.conf:settings', namespace='CELERY')
app.autodiscover_tasks()
Hey @sergey-jr :wave:, Thank you for opening an issue. We will get back to you as soon as we can. Also, check out our Open Collective and consider backing us - every little helps!
We also offer priority support for our sponsors. If you require immediate assistance please consider sponsoring us.
Getting the same error...
Error is still here to this day, even though I start a Celery worker with the -n
option:
(secator) vagrant@ubuntu2004:~/secator$ celery -A secator.celery.app worker -n runner -Q celery,io,cpu
[13:22:27] WARNING MainThread:No hostname was supplied. Reverting to default connection.py:669
'localhost'
-------------- celery@runner v5.3.4 (emerald-rush)
--- ***** -----
-- ******* ---- Linux-5.4.0-162-generic-x86_64-with-glibc2.29 2023-10-11 13:22:27
- *** --- * ---
- ** ---------- [config]
- ** ---------- .> app: secator.celery:0x7f9e07219d90
- ** ---------- .> transport: redis://localhost:6379//
- ** ---------- .> results: redis://
- *** --- * --- .> concurrency: 4 (prefork)
-- ******* ---- .> task events: ON
--- ***** -----
-------------- [queues]
.> celery exchange=celery(direct) key=celery
.> cpu exchange=cpu(direct) key=cpu
.> io exchange=io(direct) key=io
[13:22:28] WARNING MainThread:No hostname was supplied. Reverting to default connection.py:669
'localhost'
WARNING MainThread:No hostname was supplied. Reverting to default connection.py:669
'localhost'
Hmm regarding this issue, I think I've been facing multiple issues. I was using the custom BaseTask. And in BaseTask I was extending celery.Task. Seems like that was problematic for some reason. Then I read somewhere celery_app.Task shoud be extended.
I was getting this warning logged when relying on the defaults indicated in the Using Redis documentation.
My configuration:
broker_url = 'redis:///0'
The docs say "all fields after the scheme are optional, and will default to localhost on port 6379, using database 0."
Filling in the host and port with the default values eliminated the warning:
broker_url = 'redis://localhost:6379/0'
A warning for using documented behavior seems a bit odd, but I don't know the history that motivated adding it.