Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: rengine_celery-beat_1 stop working after few second #971

Closed
1 task done
zinwelzl opened this issue Oct 9, 2023 · 17 comments
Closed
1 task done

bug: rengine_celery-beat_1 stop working after few second #971

zinwelzl opened this issue Oct 9, 2023 · 17 comments

Comments

@zinwelzl
Copy link

zinwelzl commented Oct 9, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

rengine_celery-beat_1 stop working after few second
or don't start

Expected Behavior

rengine_celery-beat_1

Steps To Reproduce

kali os

Environment

- reNgine: 2
- OS: kali
- Python: Python 3.9.2
- Docker Engine: 20.10.5+dfsg1
- Docker Compose: 2.22.0
- Browser: Chromium

Anything else?

No response

@github-actions
Copy link
Contributor

github-actions bot commented Oct 9, 2023

👋 Hi @zinwelzl,
Issues is only for reporting a bug/feature request. Please read documentation before raising an issue https://rengine.wiki
For very limited support, questions, and discussions, please join reNgine Discord channel: https://discord.gg/azv6fzhNCE
Please include all the requested and relevant information when opening a bug report. Improper reports will be closed without any response.

@cezarq
Copy link

cezarq commented Oct 15, 2023

I am facing the same issue.

Environment:

- reNgine: 2.0.0
- OS: Ubuntu 23.04
- Python: Python 3.10
- Docker version 24.0.6, build ed223bc
- Docker Compose version v2.5.0
- Browser: Firefox

Current error

  File "/usr/local/lib/python3.10/dist-packages/click/decorators.py", line 33, in new_func

    return f(get_current_context(), *args, **kwargs)

  File "/usr/local/lib/python3.10/dist-packages/celery/bin/base.py", line 134, in caller

    return f(ctx, *args, **kwargs)

  File "/usr/local/lib/python3.10/dist-packages/celery/bin/beat.py", line 72, in beat

    return beat().run()

  File "/usr/local/lib/python3.10/dist-packages/celery/apps/beat.py", line 84, in run

    self.start_scheduler()

  File "/usr/local/lib/python3.10/dist-packages/celery/apps/beat.py", line 113, in start_scheduler

    service.start()

  File "/usr/local/lib/python3.10/dist-packages/celery/beat.py", line 634, in start

    humanize_seconds(self.scheduler.max_interval))

  File "/usr/local/lib/python3.10/dist-packages/kombu/utils/objects.py", line 31, in __get__

    return super().__get__(instance, owner)

  File "/usr/lib/python3.10/functools.py", line 981, in __get__

    val = self.func(instance)

  File "/usr/local/lib/python3.10/dist-packages/celery/beat.py", line 677, in scheduler

    return self.get_scheduler()

  File "/usr/local/lib/python3.10/dist-packages/celery/beat.py", line 668, in get_scheduler

    return symbol_by_name(self.scheduler_cls, aliases=aliases)(

  File "/usr/local/lib/python3.10/dist-packages/django_celery_beat/schedulers.py", line 231, in __init__

    Scheduler.__init__(self, *args, **kwargs)

  File "/usr/local/lib/python3.10/dist-packages/celery/beat.py", line 264, in __init__

    self.setup_schedule()

  File "/usr/local/lib/python3.10/dist-packages/django_celery_beat/schedulers.py", line 239, in setup_schedule

    self.install_default_entries(self.schedule)

  File "/usr/local/lib/python3.10/dist-packages/django_celery_beat/schedulers.py", line 361, in schedule

    self._schedule = self.all_as_schedule()

  File "/usr/local/lib/python3.10/dist-packages/django_celery_beat/schedulers.py", line 247, in all_as_schedule

    s[model.name] = self.Entry(model, app=self.app)

  File "/usr/local/lib/python3.10/dist-packages/django_celery_beat/schedulers.py", line 93, in __init__

    model.last_run_at = self._default_now()

  File "/usr/local/lib/python3.10/dist-packages/django_celery_beat/schedulers.py", line 143, in _default_now

    now = now.tzinfo.localize(now.replace(tzinfo=None))

AttributeError: 'zoneinfo.ZoneInfo' object has no attribute 'localize'

@AnonymousWP
Copy link
Contributor

Did you upgrade from 1.3.6? If so, consider performing a clean install of 2.0.0.

@cezarq
Copy link

cezarq commented Oct 15, 2023

I deleted my 1.3.6 version and deploy a clean install of 2.0.0.

@cezarq
Copy link

cezarq commented Oct 15, 2023

I am also getting the error "Server Error (500)" in some pages, for instance to save the report settings

[15/Oct/2023:18:19:15 +0000] "GET /api/scan_status/?project=default HTTP/1.1" 200 12874 "https://rengine.site.com/scanEngine/default/report_settings" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/118.0" "xxx.xxx.xxx.xxx"

[15/Oct/2023:18:19:31 +0000] "POST /scanEngine/default/report_settings HTTP/1.1" 500 145 "https://rengine.site.com/scanEngine/default/report_settings" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/118.0" "xxx.xxx.xxx.xxx"

[15/Oct/2023:18:19:31 +0000] "GET /favicon.ico HTTP/1.1" 500 145 "https://rengine.site.com/scanEngine/default/report_settings" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/118.0" "xxx.xxx.xxx.xxx"

@AnonymousWP
Copy link
Contributor

I don't have the zoneinfo.ZoneInfo' object has no attribute 'localize' error at all on 2.0.0. Installs and works fine for me.

@cezarq
Copy link

cezarq commented Oct 15, 2023

Thank you man, but do you suggest anything to solve the issue or any test to run, please?

@AnonymousWP
Copy link
Contributor

AnonymousWP commented Oct 15, 2023

I can reproduce the issue and it seems like it's related to the favicon missing:

image

Maybe it doesn't accept ico file extensions? Actually, in fact the entire favicon doesn't seem te exist on the current path.

image

Maybe it's related to @psyray's commit? d668985

@psyray
Copy link
Contributor

psyray commented Oct 16, 2023

Maybe it's related to @psyray's commit? d668985

Can't see why it could be related to my commit without the full error 500 details

@psyray
Copy link
Contributor

psyray commented Oct 16, 2023

I did a fresh install of a 2.0 and it's working well, favicon is loading correctly

@AnonymousWP
Copy link
Contributor

I did a fresh install of a 2.0 and it's working well, favicon is loading correctly

Huh, that's weird, I did a fresh install too. Which pages did you try to access? Tried editing the report_settings and submitted to save? That

@psyray
Copy link
Contributor

psyray commented Oct 16, 2023

I did a fresh install of a 2.0 and it's working well, favicon is loading correctly

Huh, that's weird, I did a fresh install too. Which pages did you try to access? Tried editing the report_settings and submitted to save? That

Did you remove all the docker volumes ?
If you don't remove them, install is not fresh.
But warning it erases all datas

@psyray
Copy link
Contributor

psyray commented Oct 16, 2023

File "/usr/local/lib/python3.10/dist-packages/django_celery_beat/schedulers.py", line 143, in _default_now

now = now.tzinfo.localize(now.replace(tzinfo=None))

AttributeError: 'zoneinfo.ZoneInfo' object has no attribute 'localize'

I confirm this error too and celery_beat exit on a fresh install
I'm trying to investigate

@psyray
Copy link
Contributor

psyray commented Oct 16, 2023

Seems this issue should be related
celery/django-celery-beat#668

@psyray
Copy link
Contributor

psyray commented Oct 16, 2023

@yogeshojha I think django celery beat is too old and need to be updated to be compatible with python 3.10
Version used in the docker container seems to be v2.2.1 according to this piece of code which is 2 years old !!!
https://github.com/celery/django-celery-beat/blob/a979d0a6a32e56e116a3fddaacd0d03ea79d0960/django_celery_beat/schedulers.py#L143C8-L143C64

And there is an update for Django 4.0 and python 3.10 in the v2.3.0
https://github.com/celery/django-celery-beat/blob/v2.3.0/django_celery_beat/schedulers.py

@psyray
Copy link
Contributor

psyray commented Oct 16, 2023

As a workaround with this buggy version, to make celery-beat container start and scheduler works, just add the DJANGO_CELERY_BEAT_TZ_AWARE = False settings to the web/reNgine/settings.py and do a docker-compose start celery-beat and it should work.
But your time zone will be UTC

@AnonymousWP
Copy link
Contributor

I did a fresh install of a 2.0 and it's working well, favicon is loading correctly

Huh, that's weird, I did a fresh install too. Which pages did you try to access? Tried editing the report_settings and submitted to save? That

Did you remove all the docker volumes ? If you don't remove them, install is not fresh. But warning it erases all datas

Of course, that's what I even explicitly implemented within my fork (it also asks what you want to remove).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants