Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Apache: Bugs

[Bug 47335] An extra stderr file descriptor is leaked to forked CGI processes

 

 

Apache bugs RSS feed   Index | Next | Previous | View Threaded


bugzilla at apache

Jun 9, 2009, 7:09 AM

Post #1 of 14 (1019 views)
Permalink
[Bug 47335] An extra stderr file descriptor is leaked to forked CGI processes

https://issues.apache.org/bugzilla/show_bug.cgi?id=47335





--- Comment #1 from Rainer Jung <rainer.jung [at] kippdata> 2009-06-09 07:09:23 PST ---
So is it only one additional FD during operation, or does the number of
additional FDs increase due to traffic or Apache restarts?

--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe [at] httpd
For additional commands, e-mail: bugs-help [at] httpd


bugzilla at apache

Jun 9, 2009, 7:16 AM

Post #2 of 14 (1002 views)
Permalink
[Bug 47335] An extra stderr file descriptor is leaked to forked CGI processes [In reply to]

https://issues.apache.org/bugzilla/show_bug.cgi?id=47335





--- Comment #2 from Kornél Pál <kornelpal [at] gmail> 2009-06-09 07:16:00 PST ---
There is only one extra fd that always points to the actual stderr used for the
process. The fd value (14 in the report) appears to be the same in subsequent
requests (haven't do stress test) even through different stderr pipes are used.

--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe [at] httpd
For additional commands, e-mail: bugs-help [at] httpd


bugzilla at apache

Jun 9, 2009, 7:21 AM

Post #3 of 14 (1000 views)
Permalink
[Bug 47335] An extra stderr file descriptor is leaked to forked CGI processes [In reply to]

https://issues.apache.org/bugzilla/show_bug.cgi?id=47335





--- Comment #3 from Kornél Pál <kornelpal [at] gmail> 2009-06-09 07:21:55 PST ---
Results of two subsequent requests from the production server (using suexec but
the bug is the same):

/proc/12138/fd:
total 0
dr-x------ 2 username username 0 Jun 9 09:19 .
dr-xr-xr-x 5 username username 0 Jun 9 09:19 ..
lr-x------ 1 username username 64 Jun 9 09:19 0 -> pipe:[155152349]
l-wx------ 1 username username 64 Jun 9 09:19 1 -> pipe:[155152350]
l-wx------ 1 username username 64 Jun 9 09:19 2 -> pipe:[155152351]
lr-x------ 1 username username 64 Jun 9 09:19 255 ->
/home/username/public_html/cgi-bin/leak.cgi
lr-x------ 1 username username 64 Jun 9 09:19 3483 -> pipe:[155152351]


/proc/12275/fd:
total 0
dr-x------ 2 username username 0 Jun 9 09:19 .
dr-xr-xr-x 5 username username 0 Jun 9 09:19 ..
lr-x------ 1 username username 64 Jun 9 09:19 0 -> pipe:[155153317]
l-wx------ 1 username username 64 Jun 9 09:19 1 -> pipe:[155153318]
l-wx------ 1 username username 64 Jun 9 09:19 2 -> pipe:[155153319]
lr-x------ 1 username username 64 Jun 9 09:19 255 ->
/home/username/public_html/cgi-bin/leak.cgi
lr-x------ 1 username username 64 Jun 9 09:19 3483 -> pipe:[155153319]

--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe [at] httpd
For additional commands, e-mail: bugs-help [at] httpd


bugzilla at apache

Jun 9, 2009, 8:55 AM

Post #4 of 14 (999 views)
Permalink
[Bug 47335] An extra stderr file descriptor is leaked to forked CGI processes [In reply to]

https://issues.apache.org/bugzilla/show_bug.cgi?id=47335


Ruediger Pluem <rpluem [at] apache> changed:

What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |NEEDINFO




--- Comment #4 from Ruediger Pluem <rpluem [at] apache> 2009-06-09 08:55:03 PST ---
As one can see fd14 is actually the reading site of the stderr pipe:

lr-x------ 1 daemon daemon 64 Jun 9 14:38 14 -> pipe:[85323]
l-wx------ 1 daemon daemon 64 Jun 9 14:38 2 -> pipe:[85323]

Some questions:

Which MPM are you using?
Which cgi module are you using (mod_cgi or mod_cgid)?

--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe [at] httpd
For additional commands, e-mail: bugs-help [at] httpd


bugzilla at apache

Jun 9, 2009, 10:10 AM

Post #5 of 14 (998 views)
Permalink
[Bug 47335] An extra stderr file descriptor is leaked to forked CGI processes [In reply to]

https://issues.apache.org/bugzilla/show_bug.cgi?id=47335


Kornél Pál <kornelpal [at] gmail> changed:

What |Removed |Added
----------------------------------------------------------------------------
Status|NEEDINFO |NEW




--- Comment #5 from Kornél Pál <kornelpal [at] gmail> 2009-06-09 10:10:01 PST ---
prefork
mod_cgi
Apache 2.2.11
CentOS 5.3 x86_64

--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe [at] httpd
For additional commands, e-mail: bugs-help [at] httpd


bugzilla at apache

Jun 9, 2009, 10:59 AM

Post #6 of 14 (1003 views)
Permalink
[Bug 47335] An extra stderr file descriptor is leaked to forked CGI processes [In reply to]

https://issues.apache.org/bugzilla/show_bug.cgi?id=47335





--- Comment #6 from Kornél Pál <kornelpal [at] gmail> 2009-06-09 10:59:08 PST ---
I've tried with worker and mod_cgid and the leakage is present:

/proc/10380/fd:
total 0
dr-x------ 2 daemon daemon 0 Jun 9 19:54 .
dr-xr-xr-x 5 daemon daemon 0 Jun 9 19:54 ..
lrwx------ 1 daemon daemon 64 Jun 9 19:54 0 -> socket:[72840]
lrwx------ 1 daemon daemon 64 Jun 9 19:54 1 -> socket:[72840]
lr-x------ 1 daemon daemon 64 Jun 9 19:54 13 -> pipe:[72901]
l-wx------ 1 daemon daemon 64 Jun 9 19:54 2 -> /root/httpd/logs/error_log
lr-x------ 1 daemon daemon 64 Jun 9 19:54 255 -> /root/httpd/cgi-bin/leak.cgi
lrwx------ 1 daemon daemon 64 Jun 9 19:54 3 -> socket:[68357]


/proc/10407/fd:
total 0
dr-x------ 2 daemon daemon 0 Jun 9 19:54 .
dr-xr-xr-x 5 daemon daemon 0 Jun 9 19:54 ..
lrwx------ 1 daemon daemon 64 Jun 9 19:54 0 -> socket:[73024]
lrwx------ 1 daemon daemon 64 Jun 9 19:54 1 -> socket:[73024]
lr-x------ 1 daemon daemon 64 Jun 9 19:54 13 -> pipe:[73028]
l-wx------ 1 daemon daemon 64 Jun 9 19:54 2 -> /root/httpd/logs/error_log
lr-x------ 1 daemon daemon 64 Jun 9 19:54 255 -> /root/httpd/cgi-bin/leak.cgi
lrwx------ 1 daemon daemon 64 Jun 9 19:54 3 -> socket:[68357]


fd 13 is a read pipe here as well and is a different pipe for each request just
like with mod_cgi.

Also note that fd 3 seems to be leaking as well.

--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe [at] httpd
For additional commands, e-mail: bugs-help [at] httpd


bugzilla at apache

Jun 10, 2009, 1:18 AM

Post #7 of 14 (988 views)
Permalink
[Bug 47335] An extra stderr file descriptor is leaked to forked CGI processes [In reply to]

https://issues.apache.org/bugzilla/show_bug.cgi?id=47335


Ruediger Pluem <rpluem [at] apache> changed:

What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |NEEDINFO




--- Comment #7 from Ruediger Pluem <rpluem [at] apache> 2009-06-10 01:18:18 PST ---
Can you please check if the following patch fixes your issue?

Index: threadproc/unix/proc.c
===================================================================
--- threadproc/unix/proc.c (revision 783248 ( https://svn.apache.org/viewcvs.cgi?view=rev&rev=783248 ))
+++ threadproc/unix/proc.c (working copy)
@@ -78,7 +78,7 @@

if ((err != APR_NO_PIPE) && (err != APR_NO_FILE)) {
if ((rv = apr_file_pipe_create_ex(&attr->parent_err, &attr->child_err,
- err, attr->pool)) != APR_SUCCESS)
+ err, attr->pool)) == APR_SUCCESS)
rv = apr_file_inherit_unset(attr->parent_err);
if (rv != APR_SUCCESS)
return rv;

--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe [at] httpd
For additional commands, e-mail: bugs-help [at] httpd


bugzilla at apache

Jun 10, 2009, 4:55 AM

Post #8 of 14 (985 views)
Permalink
[Bug 47335] An extra stderr file descriptor is leaked to forked CGI processes [In reply to]

https://issues.apache.org/bugzilla/show_bug.cgi?id=47335





--- Comment #8 from Kornél Pál <kornelpal [at] gmail> 2009-06-10 04:55:19 PST ---
Created an attachment (id=23784)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=23784)
mod_cgid.diff

Thanks for the patch. This fixed pipe leak for me both with mod_cgi and
mod_cgid.

Note that this fixed test seems to bogus on other plaforms as well.

mod_cgid is also leaking an extra listener socket fd (as described in Comment
#6) that can be fixed with the attached patch but I don't know if it is
compatible with APR_HAS_OTHER_CHILD.

--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe [at] httpd
For additional commands, e-mail: bugs-help [at] httpd


bugzilla at apache

Jun 10, 2009, 4:55 AM

Post #9 of 14 (985 views)
Permalink
[Bug 47335] An extra stderr file descriptor is leaked to forked CGI processes [In reply to]

https://issues.apache.org/bugzilla/show_bug.cgi?id=47335


Kornél Pál <kornelpal [at] gmail> changed:

What |Removed |Added
----------------------------------------------------------------------------
Status|NEEDINFO |NEW




--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe [at] httpd
For additional commands, e-mail: bugs-help [at] httpd


bugzilla at apache

Jun 10, 2009, 8:49 AM

Post #10 of 14 (979 views)
Permalink
[Bug 47335] An extra stderr file descriptor is leaked to forked CGI processes [In reply to]

https://issues.apache.org/bugzilla/show_bug.cgi?id=47335





--- Comment #9 from Ruediger Pluem <rpluem [at] apache> 2009-06-10 08:49:26 PST ---
Fixed the apr issue in r783398 ( https://svn.apache.org/viewcvs.cgi?view=rev&rev=783398 ) and backported it to 1.3.x / 1.4.x.

--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe [at] httpd
For additional commands, e-mail: bugs-help [at] httpd


bugzilla at apache

Jun 10, 2009, 9:05 AM

Post #11 of 14 (985 views)
Permalink
[Bug 47335] An extra stderr file descriptor is leaked to forked CGI processes [In reply to]

https://issues.apache.org/bugzilla/show_bug.cgi?id=47335





--- Comment #10 from Kornél Pál <kornelpal [at] gmail> 2009-06-10 09:05:33 PST ---
Thanks. Note that beos, netware and os2 proc.c files have exactly the same bug.
(exactly the same piece of code)

--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe [at] httpd
For additional commands, e-mail: bugs-help [at] httpd


bugzilla at apache

Jun 11, 2009, 5:21 AM

Post #12 of 14 (964 views)
Permalink
[Bug 47335] An extra stderr file descriptor is leaked to forked CGI processes [In reply to]

https://issues.apache.org/bugzilla/show_bug.cgi?id=47335





--- Comment #11 from Ruediger Pluem <rpluem [at] apache> 2009-06-11 05:20:58 PST ---
(In reply to comment #10)
> Thanks. Note that beos, netware and os2 proc.c files have exactly the same bug.
> (exactly the same piece of code)

Thanks for the hint. This is now fixed.

--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe [at] httpd
For additional commands, e-mail: bugs-help [at] httpd


bugzilla at apache

Jun 11, 2009, 5:36 AM

Post #13 of 14 (963 views)
Permalink
[Bug 47335] An extra stderr file descriptor is leaked to forked CGI processes [In reply to]

https://issues.apache.org/bugzilla/show_bug.cgi?id=47335


Ruediger Pluem <rpluem [at] apache> changed:

What |Removed |Added
----------------------------------------------------------------------------
Keywords| |FixedInTrunk




--- Comment #12 from Ruediger Pluem <rpluem [at] apache> 2009-06-11 05:36:51 PST ---
(In reply to comment #8)
> Created an attachment (id=23784)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=23784) [details]
> mod_cgid.diff
>
> Thanks for the patch. This fixed pipe leak for me both with mod_cgi and
> mod_cgid.
>
> Note that this fixed test seems to bogus on other plaforms as well.
>
> mod_cgid is also leaking an extra listener socket fd (as described in Comment
> #6) that can be fixed with the attached patch but I don't know if it is
> compatible with APR_HAS_OTHER_CHILD.

Thanks for the patch. Committed to trunk in r783740 ( https://svn.apache.org/viewcvs.cgi?view=rev&rev=783740 ) and r783742 ( https://svn.apache.org/viewcvs.cgi?view=rev&rev=783742 ).

--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe [at] httpd
For additional commands, e-mail: bugs-help [at] httpd


bugzilla at apache

Jun 11, 2009, 5:43 AM

Post #14 of 14 (974 views)
Permalink
[Bug 47335] An extra stderr file descriptor is leaked to forked CGI processes [In reply to]

https://issues.apache.org/bugzilla/show_bug.cgi?id=47335





--- Comment #13 from Kornél Pál <kornelpal [at] gmail> 2009-06-11 05:43:31 PST ---
Thanks.

--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe [at] httpd
For additional commands, e-mail: bugs-help [at] httpd

Apache bugs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.