Bug 837033 - Squid should set CLOEXEC on opened FDs
Squid should set CLOEXEC on opened FDs
Status: NEW
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: squid (Show other bugs)
6.2
All Linux
medium Severity medium
: rc
: ---
Assigned To: Luboš Uhliarik
Martin Frodl
:
Depends On:
Blocks: 1172231 1269194 1303057 840699 1269889
  Show dependency treegraph
 
Reported: 2012-07-02 10:51 EDT by Julio Entrena Perez
Modified: 2016-04-19 15:00 EDT (History)
9 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1303057 (view as bug list)
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 155473 None None None 2012-07-02 11:49:23 EDT

  None (edit)
Description Julio Entrena Perez 2012-07-02 10:51:52 EDT
Description of problem:
Squid doesn't seem to use CLOEXEC flag on opened file descriptors.
Child processes created for url rewriters execute 32k+ close() syscalls after the clone() call and before the execvp() call.
In squid-3.1.10/src/ipc.cc:

240     if (pid > 0) {              /* parent */
241         /* close shared socket with child */
[...] parent code
296     }
297 
298     /* child */
[...] child code.
      A bit later:
381     /* Make sure all other filedescriptors are closed */
382     for (x = 3; x < SQUID_MAXFD; x++)
383         close(x);

32k+ close() calls in each child process take a long time ([12-56] seconds) in Xen PV guests.
Squid re-creates all the url rewriter child processes even for a 'reload' action.

Version-Release number of selected component (if applicable):
squid-3.1.10-1.el6_2.3.x86_64

How reproducible:
Always.

Steps to Reproduce:
1. Install Squid in a RHEL6 Xen PV guest running in a RHEL5 Xen host.
2. Configure an external url rewriter and a pool of several processes:
url_rewrite_program /usr/local/bin/my_custom_url_rewriter
url_rewrite_children 24
3. Issue a 'service squid reload'.
  
Actual results:
Squid child processes take a long time to execute the 32k+ * 24 close() calls.
Browsing the Internet from clients configured to use the Squid proxy becomes unavailable for up to one minute.
Configuration changes can not be applied during work hours.

Expected results:
Squid creates file descriptors using O_CLOEXEC.
Squid doesn't need to attempt to close 32k+ FDs in each child process.
'service squid reload' completes quickly even in a Xen PV guest.

Additional info:
syscalls in a Xen PV guest perform slower than in HVM guests or bare metal, which amplifies the impact of poor FD handling in Squid child processes.
Comment 7 RHEL Product and Program Management 2013-10-13 20:35:01 EDT
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unable to address this
request at this time.

Red Hat invites you to ask your support representative to
propose this request, if appropriate, in the next release of
Red Hat Enterprise Linux.

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