DEV Community

Joscha Schultze for Cronjob.de

Posted on Edited on AI-assisted

Why cron jobs fail: what 12 days of real scheduled calls show

How often does a cron job actually fail? And when it does, why?

I run a cron service that calls URLs on a schedule, so I can look at this from the outside for a lot of very different servers: shared hosting, WordPress sites, Laravel apps, small VPSs, serverless functions. For this post I analyzed every scheduled call from 4 to 15 October 2026, 12 days in total. Heartbeat pings and our own internal jobs are excluded, so this is purely "a scheduler calls your script over HTTP".

The short version: most cron jobs are boring, a few are broken all the time, and the rare failures of healthy jobs mostly fix themselves.

Most cron jobs never fail

  • 79.9 % of cron jobs did not fail a single time in 12 days.
  • 12.0 % failed on less than 1 % of their calls.
  • 2.2 % failed on 1 to 50 % of their calls.
  • 5.9 % failed on more than half of their calls, and 4.4 % failed on every single call.

So eight in ten jobs are completely fine, and almost all the rest have the occasional hiccup. If you look only at jobs that basically work (under 50 % failures), the failure rate is 0.3 % of calls, about three in a thousand.

The failures are concentrated in very few jobs

The 5 % of cron jobs with the most failures cause 99.7 % of all failures.

That changes how you should read any "failure rate". The average across all jobs looks scary, but it's dominated by jobs that are simply dead. If you include them, the rate jumps from 0.3 % to over 9 % of all calls. Those jobs aren't flaky, they're broken, and they keep running because nobody looks.

Dead jobs: mostly an address that no longer exists

Of the jobs that failed on more than half of their calls, 56 % got a 404.

The pattern is almost always the same: the site was rebuilt, moved to a new CMS, or a plugin was removed, and the cron job still points to the old file. Nothing crashes, the scheduler just gets "not found" forever.

What helps:

  • After a relaunch or migration, go through your cron jobs the same way you go through redirects.
  • Make sure a 404 actually reaches someone. A job that fails silently for months is the real problem, not the 404 itself.

Healthy jobs: the script itself is the most common cause

For jobs that normally work, these are the share of jobs that hit each error at least once in the 12 days:

Cause Share of jobs What usually happened
Error in the script (HTTP 500) 5.4 % PHP error, memory limit, database briefly gone
Connection dropped 3.5 % Server closed the connection midway, often under load or by a firewall
Server overloaded (HTTP 503) 2.7 % Web server too busy or in maintenance
Empty reply 2.1 % Connection open, but no answer; usually the host killed the process
Upstream without an answer (HTTP 502) 1.8 % A proxy or CDN in front of the server got nothing usable
Connection refused 1.6 % Nothing listening for a moment, e.g. during a restart
TLS/HTTPS failed 1.1 % Often a certificate being replaced
Server unreachable 0.6 % Network fault or server down

Two things stand out. First, the number one cause is your own code, not the network. A 500 on a cron endpoint is usually the same bug you'd see in the browser, just at 3 a.m. Second, a big part of the list is "the server was briefly not there": overload, restarts, killed processes, proxies in between.

Tip: let your cron endpoint print a short reason when it fails, e.g. http_response_code(500); echo "Import failed: supplier API timed out";. Whatever logs or alerts your scheduler gives you, a one-line reason is worth more than a bare status code.

Two thirds of failures happen once and then fix themselves

Of all failure phases, 67 % consisted of exactly one failed call. The next run worked again.

That's an argument for two things:

  1. Don't alert on the first failure for frequent jobs. A job that runs every minute and fails once is usually noise. Alerting after two or three failures in a row cuts most false alarms without hiding real outages. For a job that runs once a night, alert on the first failure, because the next try is 24 hours away.
  2. Retry, but only when it's safe. A refused connection, a DNS error or a failed TLS handshake means the request never reached your script, so a retry is harmless. A 502 or 503 usually means the same, but not always: a gateway can lose the response after your script has already committed its work. After a 500 or a timeout the script may have done half its work. Retrying an import or a payment run blindly can do it twice. For jobs like that, give each scheduled run its own ID, send the same ID with every retry, and let the script process each ID only once. If you can't do that, don't retry them automatically. (Updated after a helpful comment from lastmileops below.)

Time limits matter for the long tail

Half of all cron jobs finished within 4.4 seconds on average, and 13 % took less than a second. But 11 % ran longer than 30 seconds on average. Those are mostly imports, exports and backups.

For that group the time limit is the real risk. Shared hosts, PHP's max_execution_time, reverse proxies and schedulers all have one, and when you hit it the script stops halfway. Typical fixes:

  • Process in batches and remember where you stopped, so each call does a fixed amount of work.
  • Or trigger the work over HTTP and let it run in the background (a queue, fastcgi_finish_request(), a worker), then report the result with a heartbeat.

Bot protection quietly blocks some jobs

A small share of jobs (0.4 %) got a Cloudflare challenge page instead of their script. For those, every call failed, because a scheduler can't solve a JavaScript or CAPTCHA check. If your site sits behind a WAF or CDN, allow your scheduler explicitly, ideally by its User-Agent or a verified-bot setting rather than by IP, since IPs can change.

Free hosts are a special case: some answer every request without a browser with a 200 and a JavaScript cookie check. The scheduler sees "success", but the script never ran. If your job reports success and nothing happens, check what the response body actually contains.

What I take from this

  • Most cron failures are not mysterious. A dead URL, a crashing script, a host that was briefly busy.
  • The dangerous jobs are the silent ones. Almost all failures come from a few jobs that stay broken because nobody gets told.
  • Alert on patterns, not single blips, and retry only what's safe to retry.
  • Look at the response, not just the status code. Both for failures (why did it fail?) and for "successes" (did the script really run?).

The full numbers, method and FAQ are on our data page: Why cron jobs fail: statistics. If you want to dig into a specific problem, I also wrote guides on a cron job that isn't running and when to retry a failed cron job.


Method: all scheduled HTTP calls made by Cronjob.de between 4 and 15 October 2026, excluding heartbeat pings and our own jobs. "Failure" means an HTTP status of 400 or higher or a network error. Percentages only, rounded. I run Cronjob.de, so this is data from one service, not the whole internet.

Top comments (2)

Collapse
 
lastmileops profile image
lastmileops •

One caveat to "the script certainly did not run": a 502 says the gateway got an invalid upstream response. An import can commit before that response fails. A 503 that you know came from a check before any work is a different case.

For jobs with side effects, I'd treat a bare 502 or 503 as an unknown outcome. If you can't rule out an effect from any earlier attempt, including one still running, only retry if replaying the same scheduled run is safe. For a database import, give each scheduled run its own ID, pass that same ID on every retry, and have the handler claim it under a unique constraint in the same transaction as the import. A useful test: return 503 before doing any work, commit the import on the next attempt but have the gateway return 502, then retry with the same ID and check that the handler saw the retry and applied the import only once.

Collapse
 
joschaschultze profile image
Joscha Schultze Cronjob.de •

You're right, "certainly" was too strong for 502 and 503. The request did reach something, and a gateway can lose the response after the import has already committed. Only a refused connection, a DNS error or a failed TLS handshake really mean the script never saw the request.

I've updated the article: 502 and 503 now count as "usually didn't run", and for jobs with side effects it says to either make a replayed run harmless or not retry automatically. Your test with the same run ID is a neat way to check that.