RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1102842 - missing /var/run/squid needed for smp mode
Summary: missing /var/run/squid needed for smp mode
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: squid
Version: 7.0
Hardware: x86_64
OS: Linux
medium
high
Target Milestone: rc
: ---
Assignee: Luboš Uhliarik
QA Contact: Ondřej Pták
URL:
Whiteboard:
Depends On:
Blocks: 1110706 1191020
TreeView+ depends on / blocked
 
Reported: 2014-05-29 16:12 UTC by Fernando Lozano
Modified: 2015-11-19 12:20 UTC (History)
9 users (show)

Fixed In Version: squid-3.3.8-25.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1301897 (view as bug list)
Environment:
Last Closed: 2015-11-19 12:20:19 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1102843 0 unspecified CLOSED SELinux prevents squid runing in SMP mode 2021-02-22 00:41:40 UTC
Red Hat Product Errata RHSA-2015:2378 0 normal SHIPPED_LIVE Moderate: squid security and bug fix update 2015-11-19 10:51:27 UTC

Internal Links: 1102843

Description Fernando Lozano 2014-05-29 16:12:32 UTC
I already submited this bug and a proposed workaround for Fedora as:

https://bugzilla.redhat.com/show_bug.cgi?id=1099970

The same problem and fix aplies to RHEL7, so I hope the updated policy can be quickly added to RHEL

Comment 5 Kevin Fenzi 2015-04-23 16:14:13 UTC
Just a note: This is actually not all that is needed to run in smp mode. ;( 

You need this fix, but then if you are using a cache_dir you have to:

* Make sure cache_dir is defined _after_ workers N in the config. 

* Use smp macros in the squid.conf to define a seperate cache_dir for each worker. 

* Manually run: squid -z -F -f /etc/squid/squid.conf to create the cache dirs before starting squid. The current systemd unit files runs this with -N (no daemon) and in that mode squid doesn't expand the macros, so it would only ever create the first cache dir. ;( 

ie: 

workers 2
if ${process_number} = 3
       # nothing
else
       cache_dir ufs /var/spool/squid/${process_number} 100 16 256
endif

Perhaps this can just be commented on in the squid.conf if smp isn't default?

Comment 6 Fernando Lozano 2015-04-23 23:47:39 UTC
Kevin, I agree having your sample config on the package squid.conf would be nice. Probably I didn't had problems creating the cache_dirs because I tested using squid-cache.org provided rpms, than just checked if the changes I need were or not on the Fedora / RHEL packages. I have not actually tried Fedora the packages.

Comment 8 Luboš Uhliarik 2015-04-27 13:49:03 UTC
(In reply to Kevin Fenzi from comment #5)
> Just a note: This is actually not all that is needed to run in smp mode. ;( 
> 
> You need this fix, but then if you are using a cache_dir you have to:
> 
> * Make sure cache_dir is defined _after_ workers N in the config. 
> 
> * Use smp macros in the squid.conf to define a seperate cache_dir for each
> worker. 
> 
> * Manually run: squid -z -F -f /etc/squid/squid.conf to create the cache
> dirs before starting squid. The current systemd unit files runs this with -N
> (no daemon) and in that mode squid doesn't expand the macros, so it would
> only ever create the first cache dir. ;( 
> 
> ie: 
> 
> workers 2
> if ${process_number} = 3
>        # nothing
> else
>        cache_dir ufs /var/spool/squid/${process_number} 100 16 256
> endif
> 
> Perhaps this can just be commented on in the squid.conf if smp isn't default?

Hi Kevin,

If I understand to your comment you correctly, you are just advising, how should system administrator configure the Squid proxy.  I can add some commented commands to squid.conf.default.

But the main problem of this bug report was, that squid was not able to handle any requests, when "workers N" option was specified in squid.conf, which was solved by adding /var/run/squid directory. I tried to reproduce this issue on my VM, and after adding this directory, issue was fixed (squid could handle requests).

Comment 9 Kevin Fenzi 2015-04-27 15:05:18 UTC
(In reply to Luboš Uhliarik from comment #8)
> Hi Kevin,
> 
> If I understand to your comment you correctly, you are just advising, how
> should system administrator configure the Squid proxy.  I can add some
> commented commands to squid.conf.default.

Yeah. 

> But the main problem of this bug report was, that squid was not able to
> handle any requests, when "workers N" option was specified in squid.conf,
> which was solved by adding /var/run/squid directory. I tried to reproduce
> this issue on my VM, and after adding this directory, issue was fixed (squid
> could handle requests).

Yes, but if you then add a simple 'cache_dir' it will break and do odd things (as all the workers share a cache_dir which shouldn't be the case). I just wanted to suggest adding some comments around that or doc note or something. Perhaps a smp howto in the portal? up to you, I just wanted to bring it up.

Comment 11 Luboš Uhliarik 2015-04-28 08:15:23 UTC
(In reply to Kevin Fenzi from comment #9)
> (In reply to Luboš Uhliarik from comment #8)
> > Hi Kevin,
> > 
> > If I understand to your comment you correctly, you are just advising, how
> > should system administrator configure the Squid proxy.  I can add some
> > commented commands to squid.conf.default.
> 
> Yeah. 
> 
> > But the main problem of this bug report was, that squid was not able to
> > handle any requests, when "workers N" option was specified in squid.conf,
> > which was solved by adding /var/run/squid directory. I tried to reproduce
> > this issue on my VM, and after adding this directory, issue was fixed (squid
> > could handle requests).
> 
> Yes, but if you then add a simple 'cache_dir' it will break and do odd
> things (as all the workers share a cache_dir which shouldn't be the case). I
> just wanted to suggest adding some comments around that or doc note or
> something. Perhaps a smp howto in the portal? up to you, I just wanted to
> bring it up.

I agree too, it is good to have it documented, so I will comment this problem and try to write some article about it.

But I'm curious, how it can break and do odd things. My testing configuration now looks like:

----------- squid.conf ----------
# 
# Recommended minimum configuration:
#
cache_dir ufs /var/cache/squid 500 16 256

...
...
...

workers 2
------------

and I'm not experiencing any problem with it. Can you please tell me, what kind of problem is happening to you, when more workers are using same cache dir? I just wanted to reproduce it for myself.

Comment 12 Luboš Uhliarik 2015-04-28 12:24:08 UTC
I found the same thing, you are talking about in Squid documentation

http://www.squid-cache.org/Doc/config/cache_dir/

"In SMP configurations, cache_dir must not precede the workers option and should use configuration macros or conditionals to give each worker interested in disk caching a dedicated cache directory."

Comment 13 Fernando Lozano 2015-04-28 12:36:42 UTC
Squid docs state that you cannot share a cachedir between workers, that's why you need the macros. As most multithreaded programming issues, you probably won't have a problems with small-scale tests.

http://wiki.squid-cache.org/Features/SmpScale

"Currently, Squid workers do not share and do not synchronize other resources and services, including (but not limited to):

    memory object cache (in some environments),
    disk object cache (except for Rock Store), 
..."

PS: In Linux the memory cache is shared, that that's why you need /var/run/squid, so it can create the shared memory files.

Comment 14 Kevin Fenzi 2015-04-28 16:27:33 UTC
Yeah, in my testing here (with 8 workers) if you share cache, sometimes workers die, sometimes it serves corrupt files, sometimes disk usage isn't cleared up. It's not an immediate failure, but it does fail.

Comment 20 Ondřej Pták 2015-10-04 20:42:10 UTC
Changing bug name, because /var/run/squid dirrectory need to be created while squid is starting. Having this dirrectory in rpm doesn't help, because in default RHEL-7 system this location is on /run, which is temporary filesystem.

Comment 33 errata-xmlrpc 2015-11-19 12:20:19 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2015-2378.html


Note You need to log in before you can comment on or make changes to this bug.