empty pid file puts monit into a loop

Issue #563 resolved
ethaniel 1 created an issue

When I restart monit, the startup is slowed down because monit is "initializing" a failing service which has an empty .pid file. Monit catches itself into a loop and doesn't do anything else.

Monit 5.20.0

[MSK Feb 19 21:21:41] error : Error reading pid from file '/var/run/sphinx/searchd.pid'
[MSK Feb 19 21:21:41] error : Error reading pid from file '/var/run/sphinx/searchd.pid'
[MSK Feb 19 21:21:42] error : Error reading pid from file '/var/run/sphinx/searchd.pid'
[MSK Feb 19 21:21:44] error : Error reading pid from file '/var/run/sphinx/searchd.pid'
[MSK Feb 19 21:21:45] error : Error reading pid from file '/var/run/sphinx/searchd.pid'
[MSK Feb 19 21:21:46] error : Error reading pid from file '/var/run/sphinx/searchd.pid'
[MSK Feb 19 21:21:47] error : Error reading pid from file '/var/run/sphinx/searchd.pid'
[MSK Feb 19 21:21:48] error : Error reading pid from file '/var/run/sphinx/searchd.pid'
[MSK Feb 19 21:21:49] error : Error reading pid from file '/var/run/sphinx/searchd.pid'
[MSK Feb 19 21:21:50] error : Error reading pid from file '/var/run/sphinx/searchd.pid'
[MSK Feb 19 21:21:51] error : Error reading pid from file '/var/run/sphinx/searchd.pid'
[MSK Feb 19 21:21:52] error : Error reading pid from file '/var/run/sphinx/searchd.pid'
[MSK Feb 19 21:21:53] error : Error reading pid from file '/var/run/sphinx/searchd.pid'
[MSK Feb 19 21:21:54] error : Error reading pid from file '/var/run/sphinx/searchd.pid'

Comments (6)

  1. Tildeslash repo owner

    Remember that Monit runs continuously. What looks like a loop is just that Monit runs and reports the same error. That is, missing pid in pid-file. If you fix this problem everything should be fine.

  2. ethaniel 1 reporter
    • changed status to open

    The problem is that no other processes are checked until it spends at least 30-40 seconds looping through this particular .pid file over and over again. According to your explanation, the file should be checked once per "daemon interval" (10 seconds in my case). But from the logs you can see that the file is checked every 1 second.

    other reports: https://bugs.launchpad.net/ubuntu/+source/monit/+bug/1277655 http://stackoverflow.com/questions/41773333/monit-is-continuously-throwing-error-reading-pid-from-file

  3. ethaniel 1 reporter

    Right now I am testing how monit handles extreme situations. And turns out it completely stops doing it's primary function (checking other processes) when it hits an error like this.

  4. Tildeslash repo owner

    It is a matter of tuning with timeout as I mentioned in another issue. Some programs are slow starters such as app servers and might need 30 sec or more to start. During these 30 sec we check if the program is up and when you run with debug you get these log-entries.

  5. Log in to comment