gocron
gocron copied to clipboard
Cron job exited after undefined amount of time
Hey there,
Thanks for your great work!
I'd like to ask whether anyone runs into the same problem. I built a cron job that checks my gmail inbox every 10 seconds using Gmail API. The code runs fine but it quits running after a while.
By monitoring, I can see sometimes it quits after 3 hours, 8 hours or sometimes just around 15 20 minutes. I monitored the memory of the process but it looks like there is no memory leak issue since it take stably around 12MB when running for 1 minute.
Please comment if you ran into this problem or you have some clue about it.
Thank you, Vu
It may have to do with the following: https://github.com/jasonlvhit/gocron/blob/master/gocron.go#L38
@jasonlvhit if you have a slice of a predefined size and simply don't want to append
, when an overflow happens perhaps you can just flush and wrap back to the beginning? I'd be happy to help contribute.
Thanks @alexanderbez but I don't get it yet. Isn't that constant the number of jobs? I only have one job.
Ahhh good catch @LeeU1911, I'll keep poking around. It could something on the system level killing it like oom
.
I am seeing this same issue. Job runs for sometimes one hour, sometimes four hours, then stops. No errors, app doesn't restart, but job just seems to stop running.
@preslavrachev @Streppel
@JohnRoesler strange... I have a job running for weeks with no problem. I'll investigate
I've been debugging on my end as well. It's running in docker. Tried increasing mem/cpu, still seeing it stop.
It's not that the job is actually stopping my case. There are no errors, it just takes long breaks on job that's scheduled to run every 5 minutes.
Here is a screen shot of logs over a 12 hour period:
Pretty sure it's not a resource issue as the docker container running the cron as an excessive amount of mem/cpu and usage is about 2% of resources.
Update - Nothing wrong with gocron! 🎉 It was a bug in my task that was causing the program to sleep for long periods of time. Sorry for the false alert.
Hi, currently I have this issue..
I have a simple job to run every 5s. But the job seems suddenly stop after a random amount of time
I run the service using systemd. With this configuration:
Description=Devops Redis Agent
After=network.target
[Service]
Type=simple
ExecStart=/usr/bin/devops-redis-agent
User=devops-agent
Group=devops-agent
[Install]
WantedBy=multi-user.target
for now, I add auto restart every hour in the systemd configuration. PS, the CPU and memory load seems OK
@truztee this repo is no longer maintained sadly. Come checkout our fork that is very well maintained and updated! https://github.com/go-co-op/gocron
@truztee this repo is no longer maintained sadly. Come checkout our fork that is very well maintained and updated! https://github.com/go-co-op/gocron
ic... thank you for the information