Frappe background jobs running for days

I have a Ubuntu 16 VPS installation of ERPnext v9.2.4 on Frappe v9.2.6. Minimal data exist in the system’s database. Three days ago it suddenly refused to open. The VPS worked normally though. I tried rebooting it, updating it, testing MySQL integrity, everything checked out. Still the ERPnext main webpage refused to open.

I looked at the ./frappe-bench/logs folder and found a 40 MB error log.

A few minutes later, the system recovered all by itself. Today the ERPnext refused to open again. I checked the logs folder and found another 40+MB error log “worker.error.log”. Inside I saw the system constantly doing these things, every 1.5 seconds, for almost 48 hours straight.

15:51:26 *** Listening on short…
15:55:26 short: frappe.utils.background_jobs.execute_job(async=True, event=u’all’, job_name=u’frappe.email.queue.flush’, kwargs={}, method=u’frappe.email.queue.flush’, site=u’site1.local’, user=u’Administrator’) (c559e8bd-093e-4880-bc5a-88a66ad48326)
15:55:26 short: Job OK (c559e8bd-093e-4880-bc5a-88a66ad48326)
15:55:26 Result is kept for 500 seconds
15:55:26
15:55:26 *** Listening on short…
15:55:26 short: frappe.utils.background_jobs.execute_job(async=True, event=u’all’, job_name=u’frappe.email.doctype.email_account.email_account.pull’, kwargs={}, method=u’frappe.email.doctype.email_account.email_account.pull’, site=u’site1.local’, user=u’Administrator’) (fa47e2ac-22ce-433d-b9a1-2d5c759caf79)
15:55:26 short: Job OK (fa47e2ac-22ce-433d-b9a1-2d5c759caf79)
15:55:26 Result is kept for 500 seconds
15:55:26
15:55:26 *** Listening on short…
15:55:26 short: frappe.utils.background_jobs.execute_job(async=True, event=u’all’, job_name=u’frappe.email.doctype.email_account.email_account.notify_unreplied’, kwargs={}, method=u’frappe.email.doctype.email_account.email_account.notify_unreplied’, site=u’site1.local’, user=u’Administrator’) (5ed20d5e-b0b7-4ddf-a9a0-7ce2f3fcfcd4)
15:55:26 short: Job OK (5ed20d5e-b0b7-4ddf-a9a0-7ce2f3fcfcd4)
15:55:26 Result is kept for 500 seconds
15:55:26
15:55:26 *** Listening on short…
15:55:26 short: frappe.utils.background_jobs.execute_job(async=True, event=u’all’, job_name=u’frappe.oauth.delete_oauth2_data’, kwargs={}, method=u’frappe.oauth.delete_oauth2_data’, site=u’site1.local’, user=u’Administrator’) (74989a72-4315-4c1a-bba2-bb2bb0cdadc8)
15:55:26 short: Job OK (74989a72-4315-4c1a-bba2-bb2bb0cdadc8)
15:55:26 Result is kept for 500 seconds
15:55:26
15:55:26 *** Listening on short…
15:55:26 short: frappe.utils.background_jobs.execute_job(async=True, event=u’all’, job_name=u’frappe.integrations.doctype.razorpay_settings.razorpay_settings.capture_payment’, kwargs={}, method=u’frappe.integrations.doctype.razorpay_settings.razorpay_settings.capture_payment’, site=u’site1.local’, user=u’Administrator’) (5e72ffae-44e5-4335-9426-1b3e57fe825e)
15:55:26 short: Job OK (5e72ffae-44e5-4335-9426-1b3e57fe825e)
15:55:26 Result is kept for 500 seconds
15:55:26
15:55:26 *** Listening on short…
15:55:26 short: frappe.utils.background_jobs.execute_job(async=True, event=u’all’, job_name=u’frappe.twofactor.delete_all_barcodes_for_users’, kwargs={}, method=u’frappe.twofactor.delete_all_barcodes_for_users’, site=u’site1.local’, user=u’Administrator’) (69af456e-578d-4439-95bb-efa1e685770d)
15:55:26 short: Job OK (69af456e-578d-4439-95bb-efa1e685770d)
15:55:26 Result is kept for 500 seconds

I have no barcodes, razorpay, twofactor or email management on the system.
What’s going on? Why are all these workers/background jobs looping infinitely?

That are scheduled jobs for frappe, feel free to remove from hooks if you dont need that; make sure removing doesn’t alter functionality.

Other than that, for some reason log are not rotating as they should …pleaase double check

Thank you for the prompt response. How do I remove from hooks?

Go to apps/frappe/frappe/hooks.py and remove that. Be aware that modifying the code doesn’t allow to run bench update.

Btw schedule runs every 4 minutes not every 1.5 sec

Thank you again. I will try it with extreme caution.