[squid-users] General Questions in squid 4.x

Alex Rousskov rousskov at measurement-factory.com
Thu Apr 13 01:35:41 UTC 2023


On 4/12/23 17:37, Dr.X wrote:

> Question #1:
> 
> My Squid server is working fine, but we accidentally removed the conf 
> file. The service is still running without any issues, but if we stop 
> it, we won't be able to power it up again as no conf file exists. Is 
> there a file dropped in RAM or somewhere else where we can retrieve the 
> configuration file?

Short answer: No.

If your Squid was configured to allow mgr:config cache manager queries, 
then you can get a "configuration dump" from the running Squid. However, 
code dumping configuration has many bugs and design flaws, so you will 
only get something that kind of resemblance the original configuration. 
You will not be able to copy-paste that output to restore the lost 
configuration.

If your Squid was configured to deny mgr:config queries (that is the 
default IIRC), then you might still be able to get the configuration 
dump mentioned above by attaching a debugging to the running Squid 
instance and adjusting Squid memory state to allow such queries, but 
doing so requires developer-level knowledge (and will freeze the Squid 
worker while you are modifying its state). I am only mentioning this 
developer-focused option for completeness sake.

See cachemgr_passwd directive documentation for more details about 
protected cache manager queries:
http://www.squid-cache.org/Doc/config/cachemgr_passwd/


> Question #2:
> 
> I believe there are some Squid config directives that are added by 
> default to squid.conf and are hidden in the config file. Is there a way 
> to check all the Squid directives that are loaded, whether they are 
> hidden or not?

A clarification for the question itself: Nothing is secretly added to 
your squid.conf file, but, yes, Squid does apply a lot of defaults and, 
to a certain extent, they are treated as if Squid found them in your 
squid.conf file.

With that clarification in mind, the short answer to your question is "No".

You can get a sense of most of the directive defaults by searching for 
"Default:" lines in squid.conf.documented, but many of those defaults 
require manual interpretation. Some of the defaults cannot be expressed 
as squid.conf directives.

Another way to look at the "active" or "actual" configuration is the 
mgr:config dump mentioned in Q1, with all its deficiencies. That dump 
does not show some of the defaults.


> Question #3:
> 
> If we start Squid but mistakenly start it again, we receive the error 
> message below:
> 
> 2023/04/12 17:33:52| FATAL: squid is already running: Found fresh 
> instance PID file (/var/run/squidtest.pid) with PID 959949

Yes, that is correct/expected behavior.


> As a result, the old service becomes dead,

That should not be happening. If by "service" you mean "squid instance", 
and you can reproduce this "old service become dead" problem with Squid 
v5+, then please file a bug report with the instructions on how to 
reproduce, preferably without using OS-specific service commands. The 
expected behavior is that the old Squid instance continues to run as if 
nothing happened.

There were related bugs in earlier Squid versions that prevented clean 
behavior during such "competing" startups, but no such bugs are known in 
Squid v5+ IIRC.


> Is there any Squid directive that prevents the instance from 
> crashing in case we accidentally start it again?
  The second concurrently started instance should quit (with an error 
message similar to the one you have shared above) without lasting side 
effects (other than logging to console or syslog), and before it starts 
accepting or generating traffic. Resources permitting, the first 
instance should continue running as if nothing happened. Anything else 
is a misconfiguration or a bug.


HTH,

Alex.



More information about the squid-users mailing list