]> git.ipfire.org Git - thirdparty/squid.git/commit
Reduce UDS/segment name clashes across same-service instances (#2023)
authorankor2023 <ankor2023@gmail.com>
Wed, 9 Jul 2025 17:45:19 +0000 (17:45 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Wed, 9 Jul 2025 18:37:13 +0000 (18:37 +0000)
commitf4232d4498fa48d37017dfeb048a335ba014e400
tree3b57080de515907f36fbb11f117d0b63dcf25081
parentc7358f4799c33db293cb6ab20e4064bcc9637865
Reduce UDS/segment name clashes across same-service instances (#2023)

Add a PID file name hash to the names of the shared memory segments and
Unix Domain Sockets. Since all instances running on the same host are
supposed to have unique PID files, this addition significantly reduces
the probability of name clashes when running multiple Squid instances
with the same service name (i.e. the same `squid -n` parameter value
that defaults to "squid").

A clash may still happen if two different PID file names have the same
hash or if multiple instances disable PID file management with
`pid_filename none`. Clashes may also happen in environments where Squid
does not even use service name for naming shared memory segments.

Examples of UDS and shared memory segment names (while using default
service name):

    /var/run/squid/squid-SLWQ-kid-1.ipc
    /var/run/squid/squid-SLWQ-coordinator.ipc
    /dev/shm/squid-SLWQ-tls_session_cache.shm
    /dev/shm/squid-SLWQ-transients_map_slices.shm

This change is a reference point for automated CONTRIBUTORS updates.
CONTRIBUTORS
src/Instance.cc
src/Instance.h
src/Makefile.am
src/ipc/Port.cc
src/ipc/mem/Segment.cc
src/tests/Stub.am
src/tests/stub_Instance.cc [new file with mode: 0644]