2

Cron jobs were working for months in the past but recently I had a high server load and now cron jobs aren't executing my php files (the same ones that were working before). When I check the cron log I see this which I believe has something to do with the issue:

(CRON) EXEC FAILED (/usr/sbin/sendmail): Resource temporarily unavailable

What do I need to do to fix this problem? I am running CentOS 7.

EDIT: I marked this as answered as I thought a process hanging was causing this issue. Today, I woke up and the same issue occurred. I wonder what could be causing this.

In the cron log, I see:

Oct 11 05:01:01 run-parts(/etc/cron.hourly)[25431]: starting 0anacron
Oct 11 05:01:01 run-parts(/etc/cron.hourly)[25444]: finished 0anacron
Oct 11 05:01:01 run-parts(/etc/cron.hourly)[25431]: starting 0yum-hourly.cron
Oct 11 05:01:01 run-parts(/etc/cron.hourly)[25450]: finished 0yum-hourly.cron
Oct 11 05:01:01 CROND[25434]: (CRON) EXEC FAILED (/usr/sbin/sendmail): Resource temporarily unavailable
Oct 11 05:01:01 CROND[25429]: (apache) MAIL (mailed 71 bytes of output but got status 0x0001

UPDATE:

I noticed two things that look off in my mail log.

Oct  8 14:01:39 postfix/local[12886]: 5180C2D098A5: to=<N@mail.domain.com>, orig_to=<N>, relay=local, delay=1.1, delays=0.07/0.01/0/1, dsn=5.1.1, status=bounced (unknown user: "n")
Oct  9 04:19:10 postfix/local[12452]: C8F762D012D6: to=<root@mail.domain.com>, orig_to=<apache>, relay=local, delay=0.22, delays=0.13/0.02/0/0.07, dsn=5.2.0, status=bounced (cannot update mailbox /var/mail/root for user root. cannot open file: Is a directory)
user3186337
  • 75
  • 1
  • 3
  • 9
  • 1
    Seems out of resource. Check yours limits, file descriptors, max process, etc. – Federico Sierra Oct 09 '15 at 01:39
  • @FedericoSierra I've increased the `limits.conf` and also `sysctl.conf` but I am still getting the same error in cron log. What user does cron use? I've increased for `apache` user which is the user that executes my php files. Maybe something with sendmail? – user3186337 Oct 09 '15 at 01:51
  • Look in your sendmail or message logs to see if there are any relevant messages. Take appropriate action. – user9517 Oct 11 '15 at 18:34
  • @lain I am checking the `mail` and `messages` log but most of it has to do with `postfix` and not `sendmail`. I do notice a lot of queued mails (600+) but that is with postfix, not sure if postfix and sendmail are one of the same? – user3186337 Oct 11 '15 at 18:50
  • okay restarting apache fixed the problem so now I have to investigate why apache is preventing my crons to stop working. – user3186337 Oct 11 '15 at 19:15
  • "cannot update mailbox /var/mail/root for user root. cannot open file: Is a directory)" So /var/mail/root is a directory, not a file? – Keefe Roedersheimer Jan 27 '16 at 03:35

1 Answers1

5

(CRON) EXEC FAILED (/usr/sbin/sendmail): Resource temporarily unavailable

This isn't a cron problem. from exec(3):

 The execl(), execle(), execlp(), execvp() and execvP() functions may fail
 and set errno for any of the errors specified for the library functions
 execve(2) and malloc(3).

From execve(2):

 [ENOMEM]           The new process requires more virtual memory than is
                    allowed by the imposed maximum (getrlimit(2)).

From malloc(3):

   ENOMEM
       Memory allocation error.

On most UNIX systems, any runaway process can consume enough resources to cause normal virtual memory allocations by non-runaway processes to also fail.

This is not a cron problem, it's a system resource, utilization, or tuning problem.

Arash Hatami
  • 105
  • 4
Paul Vixie
  • 1,144
  • 1
  • 11
  • 10
  • OP, I'm guessing your C7 box is a VPS or containerised system without swap. When load increases, and no memory is available to fulfil cron's requests, what's a system to do? – MadHatter Jan 27 '16 at 07:20