Bug #67383 [Com]: exec() leaks file and socket descriptors to called program
Edit report at https://bugs.php.net/bug.php?id=67383&edit=1
ID: 67383
Comment by: brak at gameservers dot com
Reported by: langemeijer@php.net
Summary: exec() leaks file and socket descriptors to called
program
Status: Open
Type: Bug
Package: *General Issues
Operating System: linux
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
This issue can cause you to be unable to restart PHP-FPM. Specifically, this leaks the webserver
-> php-fpm socket to any process you execute. This prevents PHP-FPM from cleanly restarting
until the process exits, because the socket will already be in use.
Quick example:
<?php
$p = popen('/bin/bash -c "sleep 60"','w');
pclose($p);
?>
Now find the child process (ps aux | grep sleep) and lsof -p XXX -n:
sleep 13443 nobody 0r FIFO 0,8 0t0 10237775 pipe
sleep 13443 nobody 1u CHR 1,3 0t0 3920 /dev/null
sleep 13443 nobody 2u CHR 1,3 0t0 3920 /dev/null
sleep 13443 nobody 4u IPv4 10236693 0t0 TCP 127.0.0.1:cslistener->127.0.0.1:53151
(ESTABLISHED)
sleep 13443 nobody 9u REG 0,9 0 3918 [eventpoll]
FD 4 there is the TCP connection from the PHP worker process to the web server.
Previous Comments:
------------------------------------------------------------------------
[2014-08-04 19:46:06] langemeijer@php.net
Related To: Bug #43290
------------------------------------------------------------------------
[2014-08-04 19:41:09] langemeijer@php.net
Related To: Bug #66611
------------------------------------------------------------------------
[2014-08-04 19:36:40] langemeijer@php.net
Related To: Bug #67654
------------------------------------------------------------------------
[2014-08-04 19:35:48] langemeijer@php.net
Obviously, this bug is not a duplicate of itself. Previous comment was a clerical error.
------------------------------------------------------------------------
[2014-07-21 11:54:20] langemeijer@php.net
This is a duplicate of bug #67383 (Which contains a patch that should be merged by someone!)
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=67383
--
Edit this bug report at https://bugs.php.net/bug.php?id=67383&edit=1
Thread (5 messages)