'Centos 7 - httpd service fails once every 5 days with status code 254/n/a

That's weird because it happens only once every 5 nights.

I have a cron job which restarts httpd service every night, but I'm receiving this error once every 5 nights.

Apr 24 04:33:03 system systemd: httpd.service: main process exited, code=exited, status=254/n/a
Apr 24 04:33:03 system systemd: Unit httpd.service entered failed state.
Apr 24 04:33:03 system systemd: httpd.service failed.

And this is my script to restart httpd

...

/usr/sbin/httpd -k restart

...

I've checked permissions of /tmp folder and it all looks good.

  File: ‘/tmp’
  Size: 12288       Blocks: 24         IO Block: 4096   directory
Device: 803h/2051d  Inode: 2359297     Links: 24
Access: (1777/drwxrwxrwt)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2022-04-25 10:05:41.726022978 +0300
Modify: 2022-04-25 10:07:02.568018159 +0300
Change: 2022-04-25 10:07:02.568018159 +0300
 Birth: -

And this is what i found in error_log of httpd.

Fatal Error Unable to create lock file: Bad file descriptor (9)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source