this post was submitted on 16 Nov 2026
57 points (93.8% liked)

Programming

29288 readers
538 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 3 years ago
MODERATORS
 

had this bizarre issue where a backup script ran fine monday through friday but failed every saturday. took me way too long to figure out.

turns out the script was calling an internal API that had rate limiting. during the week, the backup ran at 2am when nobody was using the system. on saturdays, some other batch process kicked off at the same time and ate up all the API quota.

the fix was dead simple β€” stagger the start time by 30 minutes. but finding the cause? that was a couple hours of my life I'm not getting back.

moral of the story: if your cron job is failing intermittently, check what else runs at the same time. crontab -l only shows YOUR crontab. other users and system crontabs in /etc/cron.d/ might be competing for the same resources.

top 23 comments
sorted by: hot top controversial new old
[–] shalafi@lemmy.world 1 points 1 hour ago

Since we're sharing troubleshooting weirdness:

My Active Directory admin account kept getting locked out on a seemingly random basis, about once every day or two. Had my bosses credentials, and yes, I know how dumb that is, so I'd unlock myself. No one else was affected, but it was an annoyance for me.

After two months of sporadic troubleshooting, I found it! When I first setup the domain (it was my first time, ok?!), I used my personal credentials to allow the DHCP server to poll the DNS server (something like that). Everytime some PC needed a new lease, it would use my personal creds 3 times and then fail. Because I had changed my password like a good little admin. πŸ™„

[–] communism@lemmy.ml 4 points 5 hours ago

The cronjobs are striking for a five-day week. They want a weekend too.

[–] ultimaluz@lemmy.world 2 points 6 hours ago

not weekends but I had one that failed on two random days in a month and looked totally fine the rest. it's a scheduled job that reads a couple of sites through a logged in browser on my laptop, and those two days the browser just wasn't connected, so the job ran on time and had nothing to read. the log said "ok, nothing new" which is the worst kind of failure lol. now it uses a browser that keeps its own session and the other one only as fallback, and an empty result gets reported as a failure and not as a quiet day. same lesson as yours I guess, check what else has to be alive at that moment, not only what's running

[–] tgt@programming.dev 33 points 14 hours ago (1 children)
[–] shalafi@lemmy.world 1 points 1 hour ago

My all-time favorite troubleshooting story! Worth a quick read for anyone unfamiliar.

[–] bajabound@lemmy.world 16 points 12 hours ago (1 children)

I have a cron job that has been failing since I added it. I'll get around to fixing it at some point.

[–] daychilde@lemmy.world 2 points 5 hours ago

This is the way.

[–] Kissaki@programming.dev 54 points 16 hours ago (3 children)

I'll take this opportunity to share a classic: https://beza1e1.tuxen.de/lore/high_tide.html

"Its high tide!"

Which was met with blank looks and probably a wavering hand over the intercom to Security.

"It stops working at high tide"

[–] daychilde@lemmy.world 2 points 5 hours ago

Ah, a delight. I hadn't heard that one before.

[–] sup@lemmy.ca 5 points 14 hours ago (1 children)

Well that was one hell of a story

[–] shalafi@lemmy.world 3 points 1 hour ago (1 children)
[–] sup@lemmy.ca 1 points 1 hour ago

No, first time reading this! This is insane, haha thank you for sharing. Crazy stuff!

[–] onlinepersona@programming.dev 4 points 13 hours ago

Why give away the story?

[–] lemmybeyourfwend@lemmy.org 2 points 8 hours ago

Yes, they get lazy during the weekend.

[–] Jayjader@jlai.lu 1 points 7 hours ago

I was just reading an article today about how now that there's more and more uninterruptible power supplies plugged into the grid, notably with all the data centers that were built over the last 20 years, the grid itself experiences a similar disturbance ever minute as all the factory-default-configured systems pulse to check their internal battery state.

The article concluded with "the simplest fix would be to stagger/randomize the default check times, but how can we encourage manufacturers to do so?"

[–] vfscanf@discuss.tchncs.de 21 points 15 hours ago (1 children)
[–] almost1337@lemmy.zip 1 points 5 hours ago

This is why we can't have nice things

[–] who@feddit.org 2 points 9 hours ago

It's common practice to stagger cron jobs to run at different offsets from the hour. This can mitigate load spikes, both local and remote.

[–] ctrlzee@lemmy.world 8 points 14 hours ago

Loved the replies. Once it’s over (that’s the hard part), everyone has a funny story to tell!

Mine was a race condition in an outsourced core system that showed up about six months after release, only when enough transactions hit at the same moment. The contact centre was on fire, with people calling non-stop.

Same lesson as yours: when something fails only sometimes, stop staring at the code and look at what else is running at that moment.

[–] Skullgrid@lemmy.world 2 points 11 hours ago

good advice, good job.

[–] exu@feditown.com 6 points 15 hours ago* (last edited 9 hours ago)

That's why I uses systemd timers with RandomizeDelay. Spreads the load a bit

[–] elvith@feddit.org 3 points 13 hours ago

We had a pipeline suddenly fail everytime when it ran on its weekly schedule but all manual triggers were OK.

After a few weeks we learned that the Linux admins had moved the weekly patch window of the runners to exactly the time our schedule ran the pipeline and this caused all kinds of unpredictable problems.

We then moved the scheduled time and since then the pipeline runs without a hitch

Your writing style is the one LLMs must be based on. Even got a em dash in there