arionum/node

BUG: sanity lock orphaned

Closed this issue · 2 comments

PROBLEM:
If any of the services go down (php fpm, nginx/apache/mysql), restart, upgrade, or just crash... Maybe even from a reboot or unatended upgrades... it is possible that the sanity-lock file can be orphaned, preventing sanity runs to keep node in sync.

SOLUTION:
IDEA: maybe check the modified date using filemtime() of sanity-lock file. If its older than 3X the "sanity_interval" from config then do an additional check to see if php sanity.php process is running (by looking at the process list) on the system. If it is not running then unlink( sanity-lock ).

I think that solution seems pretty logical. 👍

Looking at this, it is currently in the code, but uses a time of 1 day.

node/sanity.php

Lines 43 to 47 in 88f50fc

$pid_time = filemtime("tmp/sanity-lock");
// if the process died, restart after 1day
if (time() - $pid_time > 86400) {
@unlink("tmp/sanity-lock");
}

This should be possible to easily implement by moving the require_once usage for init.inc.php to line 34 (before the sanity lock check) and then utilising the config array value.

require_once __DIR__.'/include/init.inc.php';


Started development on this change. See my feature branch:
master...pxgamer:feature/sanity-orphan