django-health-check: Timeout for waiting Self.Chanel

Hi Kristian,

I am having this issue in the code below: in the MainView get method:

            for plugin_class, options in plugin_dir._registry:
                plugin = plugin_class(**copy.deepcopy(options))
                try:
                    plugin.run_check()
                    plugins.append(plugin)
                    errors += plugin.errors
                except Exception as ex1:
                    return {}

In the for loop, when the plugin_class is the health_check.contrib.celery.backends.CeleryHealthCheck, I get the timeout exception in the messaging.py file line 187:

        channel = self.channel

It just occurs only when tthe plugin_class is the health_check.contrib.celery.backends.CeleryHealthCheck.

I have config celery==4.1.0.

Could you please take a look on it?

Thanks, Thanh

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 1
  • Comments: 15

Most upvoted comments

If you guys are running this inside a docker container, I’ve experienced this as well, and fixed it by reloading the celery app within Health Check

like so:

            app = Celery('HealthCheckApp')
            app.config_from_object('django.conf:settings', namespace='CELERY')
            installed_apps = [app_config.name for app_config in apps.get_app_configs()]
            app.autodiscover_tasks(lambda: installed_apps, force=True)

Apparently there is an issue when you run celery inside a thread on docker that it fails to get the config correctly…

You’re welcome @mhoonjeon. I really hope it works 😬 👍, please let us know…

@henryfentanes I was trying a few more ways to see if I could figure out myself - before asking you the question. So I deleted the question. One thing I didn’t realize was that I would be getting such a quick reply! I really appreciate that! Thanks! I’ll try with your suggestion to see if it works! 👍

Hi @thanhcg Thanks for reaching out. I took the liberty to add some code highlighting. Would be be so good to tell me, which version of django-health-check you are using. Can please also provide me with a full stack trace of your error? That would help me a lot.

Thanks -Joe