On 07/05/17 09:59, Eduard Bagdasaryan wrote:
This patch makes PID file check/creation atomic to avoid associated race conditions.
I do not see any use of atomic's in this patch. Please use std::atomic locks to ensure actually atomic operations on the file locks. Squid does have some child processes operating as threads so custom implementations that don't use real atomic's will fail under some circumstances.
Authors: Alex Rousskov, Eduard Bagdasaryan After this change, if N Squid instances are concurrently started shortly after time TS, then exactly one Squid instance (X) will run (and have the corresponding PID file). If another Squid instance has already been running (with the corresponding PID file) at TS, then X will be that "old" Squid instance. If no Squid instances were running at TS, then X will be one of those new N Squids started after TS. Lack of atomic PID file operations caused unexpected Squid behavior: * Mismatch between started Squid instance and stored PID file. * Unexpected crashes due to failed allocation of shared resources, such as listening TCP ports or shared memory segments. A new File class guarantees atomic PID file operations using locks. We tried to generalize/reuse Ssl::Lock from the certificate generation
What Ssl::Lock class? Amos _______________________________________________ squid-dev mailing list [email protected] http://lists.squid-cache.org/listinfo/squid-dev
