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 837033 - Squid should set CLOEXEC on opened FDs
Summary: Squid should set CLOEXEC on opened FDs
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: squid
Version: 6.2
Hardware: All
OS: Linux
Target Milestone: rc
: ---
Assignee: Luboš Uhliarik
QA Contact: Martin Frodl
Depends On:
Blocks: 840699 1172231 1269194 1269889 1303057
TreeView+ depends on / blocked
Reported: 2012-07-02 14:51 UTC by Julio Entrena Perez
Modified: 2018-12-05 15:34 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1303057 (view as bug list)
Last Closed: 2016-07-28 19:37:05 UTC
Target Upstream Version:

Attachments (Terms of Use)

System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 155473 0 None None None 2012-07-02 15:49:23 UTC

Description Julio Entrena Perez 2012-07-02 14:51:52 UTC
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     }
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):

How reproducible:

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 Program Management 2013-10-14 00:35:01 UTC
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.