-
Notifications
You must be signed in to change notification settings - Fork 603
Reduce UDS/segment name clashes across same-service instances #2023
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reduce UDS/segment name clashes across same-service instances #2023
Conversation
Add GetPidFilenameHash() prototype
Add Instance::GetPidFilenameHash() and murmur3_32() functions.
Prevent shared memory segment names clashes.
Updated comment
Add Instance uniq label to filename
Add PID filename hash label to the coordinator filename.
Code formatting
Code formatting
Code formatting
|
Build issues are because the Also, why the murmur hash? The original proposal was just to add the PID number (from the "master" or "coordinator" process). If we do need to hash for any reason Squid uses |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amos: The original proposal was just to add the PID number
It was not. Proposal A was to add a hash of the full PID file name.
Adding a PID number instead of a hash would solve the problem with segment clashes as well but would create a worse problem: Segments left by crashed Squid instances will accumulate instead of being removed (because each instance is likely to have a unique master PID value, even instances that have the same PID file name).
Amos: If we do need to hash for any reason Squid uses
libnettle, for a selection of speed and security options.
I agree that this PR should not introduce a new hash function. However, please do not rely on libnettle for this PR either; essentially, ignore that libnettle exists. See one of the change requests for a specific hash function recommendation.
Add dependencies
Add dependencies
Add dependencies
Add dependencies
Remove redundant dependencies
This comment was marked as outdated.
This comment was marked as outdated.
Replace mumur for MD5
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.
@kinkie, if restarting that failed FreeBSD v13.4 staging test is not the answer, then please help getting past that package versioning error. Edit: @yadij has already flagged the same problem at #2110 (comment). I will just follow the discussion in that PR to reduce the noise here. |
|
CI unblocked by PR #2112 |
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.
To add one more data point for the future followup PR(s) to consider, here is a segment name I just saw in the logs produced by an older (v5- or v6-based?) Squid: That name is 55-characters long and cannot be shortened enough by simply shortening If we want to fully support SMP Squid on MacOS, then we need a different way to produce short names: Either a hash or some kind of enumeration. To avoid completely mishandling, for example, instances where different kids have a different set of cache_dir directives or a different cache_dir directives order, both options would have to use a central hashing/enumeration authority (e.g., a new special/dedicated shared memory segment mapping full names to hashes or enumeration IDs). |
…cache#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.
…cache#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.
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.
|
backport to v7 completed. |
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 -nparameter valuethat 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 Squiddoes not even use service name for naming shared memory segments.
Examples of UDS and shared memory segment names (while using default
service name):
This change is a reference point for automated CONTRIBUTORS updates.