Remove a lock file left in a PKI store by an older node-opcua, so that the
current one can use the store at all.
node-opcua-pki serialises every mutation of a store (withLock2) on
<rootFolder>/mutex.lock. Today's global-mutex (3.x) takes that lock by
creating a directory of that name; its predecessor (2.x, built on the
lockfile package) created a plain file and left it behind when the
process died holding it. Neither provider of the current library treats that
file as the garbage it is: the native one only decides by mtime and waits
until the file looks two minutes old, the proper-lockfile one calls rmdir on
it, gets ENOTDIR and retries for hours. In both cases the first move into
rejected/ or trusted/ never answers, and an OpenSecureChannel that waits on
that verdict never answers either (FEAT-40, the CTT's Security Certificate
Validation scripts timing out on Windows).
A regular file at that path can never be a live lock of the current library,
so it is removed before the store is first used. A directory is a real lock
and is left alone.
Remove a lock file left in a PKI store by an older node-opcua, so that the current one can use the store at all.
node-opcua-pki serialises every mutation of a store (
withLock2) on<rootFolder>/mutex.lock. Today's global-mutex (3.x) takes that lock by creating a directory of that name; its predecessor (2.x, built on thelockfilepackage) created a plain file and left it behind when the process died holding it. Neither provider of the current library treats that file as the garbage it is: the native one only decides by mtime and waits until the file looks two minutes old, the proper-lockfile one calls rmdir on it, gets ENOTDIR and retries for hours. In both cases the first move into rejected/ or trusted/ never answers, and an OpenSecureChannel that waits on that verdict never answers either (FEAT-40, the CTT's Security Certificate Validation scripts timing out on Windows).A regular file at that path can never be a live lock of the current library, so it is removed before the store is first used. A directory is a real lock and is left alone.