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

BackgroundScheduler is not working after few hours #515

Closed
Nayyaroddeen opened this issue May 28, 2021 · 6 comments
Closed

BackgroundScheduler is not working after few hours #515

Nayyaroddeen opened this issue May 28, 2021 · 6 comments

Comments

@Nayyaroddeen
Copy link

Nayyaroddeen commented May 28, 2021

I am using the django to build a reminders service
the current version of apscheduler=3.7.0

Issue: Scheduling and executing of jobs works fine for 10 hours of spinning the server. Post that we are able to add job but BackgroundScheduler is not able to execute the given function. I have enabled the logging but didn't find anything in logs

What could be the potential reason?

#creating a scheduler
scheduler = BackgroundScheduler(timezone=settings.TIME_ZONE)
scheduler.add_jobstore(DjangoJobStore(), "default")
if not scheduler.running:
    scheduler.start()

#adding job
 job = scheduler.add_job(send_reminder,
                                        trigger='date',
                                        next_run_time=str(date_time),
                                        args=[text])

#function to execute
def send_reminder(text, recruiter_id, company_id, application_id):
     print("something")
@agronholm
Copy link
Owner

I'm surprised this works at all, since there is nothing in this script to keep the background scheduler running and the script would just exit.

You also seem to be using an unofficial job store which may also be a problem.

@agronholm
Copy link
Owner

If you can give me a script that reproduces the problem using an official job store, I can investigate the problem.

@Nayyaroddeen
Copy link
Author

Nayyaroddeen commented May 28, 2021

@agronholm yes, I copied parts of the script. I found there is an issue with threads flag --enable-threads for uWSGI https://apscheduler.readthedocs.io/en/latest/faq.html. I am experimenting with https://gunicorn.org/, logs are coming properly. I will update the ticket accordingly. Thank you.

@jjqi92
Copy link

jjqi92 commented Aug 18, 2021

has the problem been solved? i had the same problem, and the log didn't have anything error or exception

@Nayyaroddeen
Copy link
Author

It happens due to mysql server disconnection. were you able to check it?

@agronholm
Copy link
Owner

Closing as obsolete.

@agronholm agronholm closed this as not planned Won't fix, can't repro, duplicate, stale Jul 27, 2024
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

3 participants