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.

Celery continuously warning "No hostname was supplied. Reverting to default 'None'"

See original GitHub issue

After updating from:

 name = "celery"
-version = "5.0.5"
+version = "5.1.2"
 name = "kombu"
-version = "5.0.2"
+version = "5.1.0"

Kombu continuously emits this warning:

No hostname was supplied. Reverting to default 'None'

It seems to happen every time I queue a celery task (i.e.: `my_task.delay() from a celery task.

  File "celery", line 8, in <module>
    sys.exit(main())
  File "celery/__main__.py", line 15, in main
    sys.exit(_main())
  File "celery/bin/celery.py", line 213, in main
    return celery(auto_envvar_prefix="CELERY")
  File "click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "click/decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "celery/bin/base.py", line 133, in caller
    return f(ctx, *args, **kwargs)
  File "celery/bin/worker.py", line 346, in worker
    worker.start()
  File "celery/worker/worker.py", line 203, in start
    self.blueprint.start(self)
  File "celery/bootsteps.py", line 116, in start
    step.start(parent)
  File "celery/bootsteps.py", line 365, in start
    return self.obj.start()
  File "celery/worker/consumer/consumer.py", line 326, in start
    blueprint.start(self)
  File "celery/bootsteps.py", line 116, in start
    step.start(parent)
  File "celery/worker/consumer/consumer.py", line 618, in start
    c.loop(*c.loop_args())
  File "celery/worker/loops.py", line 81, in asynloop
    next(loop)
  File "kombu/asynchronous/hub.py", line 361, in create_loop
    cb(*cbargs)
  File "celery/concurrency/asynpool.py", line 482, in _event_process_exit
    self.maintain_pool()
  File "billiard/pool.py", line 1351, in maintain_pool
    self._maintain_pool()
  File "billiard/pool.py", line 1343, in _maintain_pool
    self._repopulate_pool(joined)
  File "billiard/pool.py", line 1328, in _repopulate_pool
    self._create_worker_process(self._avail_index())
  File "celery/concurrency/asynpool.py", line 477, in _create_worker_process
    return super()._create_worker_process(i)
  File "billiard/pool.py", line 1158, in _create_worker_process
    w.start()
  File "billiard/process.py", line 124, in start
    self._popen = self._Popen(self)
  File "billiard/context.py", line 333, in _Popen
    return Popen(process_obj)
  File "billiard/popen_fork.py", line 24, in __init__
    self._launch(process_obj)
  File "billiard/popen_fork.py", line 79, in _launch
    code = process_obj._bootstrap()
  File "billiard/process.py", line 327, in _bootstrap
    self.run()
  File "billiard/process.py", line 114, in run
    self._target(*self._args, **self._kwargs)
  File "billiard/pool.py", line 292, in __call__
    sys.exit(self.workloop(pid=pid))
  File "billiard/pool.py", line 362, in workloop
    result = (True, prepare_result(fun(*args, **kwargs)))
  File "celery/app/trace.py", line 646, in fast_trace_task
    R, I, T, Rstr = tasks[task].__trace__(
  File "celery/app/trace.py", line 450, in trace_task
    R = retval = fun(*args, **kwargs)
  File "celery/app/trace.py", line 731, in __protected_call__
    return self.run(*args, **kwargs)
  File "idf/sync/tasks.py", line 86, in generate_missing_archives
    tasks.post_process_order.delay(archive.order_id)
  File "celery/app/task.py", line 422, in delay
    return self.apply_async(args, kwargs)
  File "celery/app/task.py", line 572, in apply_async
    return app.send_task(
  File "celery/app/base.py", line 763, in send_task
    with self.producer_or_acquire(producer) as P:
  File "celery/utils/objects.py", line 84, in __enter__
    context = self._context = self.fallback(
  File "kombu/resource.py", line 81, in acquire
    R = self.prepare(R)
  File "kombu/pools.py", line 60, in prepare
    p = p()
  File "kombu/utils/functional.py", line 186, in __call__
    return self.evaluate()
  File "kombu/utils/functional.py", line 189, in evaluate
    return self._fun(*self._args, **self._kwargs)
  File "kombu/pools.py", line 40, in create_producer
    conn = self._acquire_connection()
  File "kombu/pools.py", line 37, in _acquire_connection
    return self.connections.acquire(block=True)
  File "kombu/resource.py", line 81, in acquire
    R = self.prepare(R)
  File "kombu/connection.py", line 1017, in prepare
    resource = resource()
  File "kombu/utils/functional.py", line 186, in __call__
    return self.evaluate()
  File "kombu/utils/functional.py", line 189, in evaluate
    return self._fun(*self._args, **self._kwargs)
  File "kombu/connection.py", line 989, in new
    return self.connection.clone()
  File "kombu/connection.py", line 618, in clone
    return self.__class__(**dict(self._info(resolve=False), **kwargs))
  File "kombu/connection.py", line 631, in _info
    logger.warning(
  File "__init__.py", line 1458, in warning
    self._log(WARNING, msg, args, **kwargs)
  File "__init__.py", line 1589, in _log
    self.handle(record)
  File "__init__.py", line 1599, in handle
    self.callHandlers(record)
  File "__init__.py", line 952, in handle
    self.emit(record)

Variables

D {port: None}
resolve False
self <Connection: sqs://localhost// at 0x7f784f4823a0>
transport_cls ‘sqs’

Can this have negative side effects, or should I worry about it? What exactly is wrong here?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:6
  • Comments:17 (6 by maintainers)

github_iconTop GitHub Comments

4reactions
DragosChirilacommented, Aug 9, 2021

@thedrow Yes, I do. The setup and all the details are the same as in this one https://github.com/celery/celery/issues/6895 but instead of connecting to the default I am connecting to AWS SQS.

Django’s settings.py

CELERY_BROKER_URL = 'sqs://{}:{}@'.format(
    urllib.parse.quote(os.getenv('CELERY_AWS_ACCESS_KEY_ID', '?'), safe=''),
    urllib.parse.quote(os.getenv('CELERY_AWS_SECRET_ACCESS_KEY', '?'), safe='')
)
BROKER_URL = CELERY_BROKER_URL

CELERY_DEFAULT_QUEUE = os.getenv('CELERY_DEFAULT_QUEUE')
CELERY_PRIORITY_QUEUE = os.getenv('CELERY_PRIORITY_QUEUE')

CELERY_TASK_DEFAULT_QUEUE = CELERY_DEFAULT_QUEUE
SQS_QUEUE_NAME = CELERY_DEFAULT_QUEUE
CELERY_QUEUES = {
    CELERY_DEFAULT_QUEUE: {
        'exchange': CELERY_DEFAULT_QUEUE,
        'binding_key': CELERY_DEFAULT_QUEUE,
    },
    CELERY_PRIORITY_QUEUE: {
        'exchange': CELERY_PRIORITY_QUEUE,
        'binding_key': CELERY_PRIORITY_QUEUE,
    }
}
CELERY_TASK_QUEUES = CELERY_QUEUES
CELERY_TASK_CREATE_MISSING_QUEUES = False

CELERY_ACCEPT_CONTENT = ['application/json']
CELERY_RESULT_SERIALIZER = 'json'
CELERY_TASK_SERIALIZER = 'json'

CELERY_BROKER_TRANSPORT_OPTIONS = {
    'region': AWS_REGION,
    'polling_interval': int(os.getenv('CELERY_POLLING_INTERVAL')),
    'wait_time_seconds': int(os.getenv('CELERY_WAIT_TIME_SECONDS')),
    'visibility_timeout': 3600
}
BROKER_TRANSPORT_OPTIONS = CELERY_BROKER_TRANSPORT_OPTIONS

Here is the traceback

$ celery -A project worker -l info -Ofair --without-gossip --without-mingle
[2021-08-10 08:37:31,012: WARNING/MainProcess] No hostname was supplied. Reverting to default 'None'
 
 -------------- celery@dragos v5.1.2 (sun-harmonics)
--- ***** ----- 
-- ******* ---- Linux-5.4.0-77-generic-x86_64-with-glibc2.27 2021-08-10 08:37:31
- *** --- * --- 
- ** ---------- [config]
- ** ---------- .> app:         project:0x7f5effafd640
- ** ---------- .> transport:   sqs://**:**@localhost//
- ** ---------- .> results:     disabled://
- *** --- * --- .> concurrency: 12 (prefork)
-- ******* ---- .> task events: OFF (enable -E to monitor tasks in this worker)
--- ***** ----- 
 -------------- [queues]
                .> dev         exchange=dev(direct) key=dev
                .> dev-acdc    exchange=dev-acdc(direct) key=dev-acdc

[tasks]
  ...
  <list of tasks here>
  ...

[2021-08-10 08:37:32,938: WARNING/MainProcess] No hostname was supplied. Reverting to default 'None'
[2021-08-10 08:37:32,939: INFO/MainProcess] Connected to sqs://**:**@localhost//

The celery worker works fine, it consumes messages, no problem there. What is bugging me is that warning message that pops up in the console from time to time.

Please let me know if you need further details. Thank you.

3reactions
WhyNotHugocommented, Jan 11, 2022

You can ignore this warning with:

import warnings

warnings.filterwarnings("ignore", "No hostname was supplied")

I had to add this after the issue quickly ate my Sentry quota for a month.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Celery No hostname was supplied. Reverting to default ...
I'm following the steps for Celery here. I have this in my celery.py from __future__ import absolute_import, unicode_literals import os ...
Read more >
Celery Tutorial. Problem Statement: (Server Overload) - Medium
celery -A proj worker -l INFO[2021-10-06 16:56:46,941: WARNING/MainProcess] No hostname was supplied. Reverting to default 'localhost'
Read more >
Source code for kombu.connection - Celery
:keyword virtual_host: Default virtual host if not provided in the URL. ... and not ssl: logger.warning( 'Secure redis scheme specified (rediss) with no...
Read more >
Connection - Kombu 5.2.4 documentation - Celery
NOTE: You cannot specify both the URL argument and use the hostname keyword argument at the same time. userid – Default user name...
Read more >
Celery does not register tasks - Django Forum
celery -A landscape worker -l INFO [2022-06-30 14:48:36,670: WARNING/MainProcess] No hostname was supplied. Reverting to default 'localhost' ...
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