Hi Jens, thanks for taking the time to file a bug report. I'm having
trouble reproducing this issue. When I install apache2 and php5-cgi and
copy a simple php file to /usr/lib/cgi-bin, I don't get any opening of
/proc files at all. This is the list I see when cgi is forked (the
parent process doesn't open any new files on requests):

[pid 30702] open("/usr/local/lib/tls/x86_64/libcrypt.so.1", O_RDONLY|O_CLOEXEC) 
= -1 ENOENT (No such file or directory)
[pid 30702] open("/usr/local/lib/tls/libcrypt.so.1", O_RDONLY|O_CLOEXEC) = -1 
ENOENT (No such file or directory)
[pid 30702] open("/usr/local/lib/x86_64/libcrypt.so.1", O_RDONLY|O_CLOEXEC) = 
-1 ENOENT (No such file or directory)
[pid 30702] open("/usr/local/lib/libcrypt.so.1", O_RDONLY|O_CLOEXEC) = -1 
ENOENT (No such file or directory)
[pid 30702] open("/usr/lib/tls/x86_64/libcrypt.so.1", O_RDONLY|O_CLOEXEC) = -1 
ENOENT (No such file or directory)
[pid 30702] open("/usr/lib/tls/libcrypt.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT 
(No such file or directory)
[pid 30702] open("/usr/lib/x86_64/libcrypt.so.1", O_RDONLY|O_CLOEXEC) = -1 
ENOENT (No such file or directory)
[pid 30702] open("/usr/lib/libcrypt.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No 
such file or directory)
[pid 30702] open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
[pid 30702] open("/lib/x86_64-linux-gnu/libcrypt.so.1", O_RDONLY|O_CLOEXEC) = 3
[pid 30702] open("/usr/local/lib/libz.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT 
(No such file or directory)
[pid 30702] open("/usr/lib/libz.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such 
file or directory)
[pid 30702] open("/lib/x86_64-linux-gnu/libz.so.1", O_RDONLY|O_CLOEXEC) = 3
[pid 30702] open("/usr/local/lib/libresolv.so.2", O_RDONLY|O_CLOEXEC) = -1 
ENOENT (No such file or directory)
[pid 30702] open("/usr/lib/libresolv.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No 
such file or directory)
[pid 30702] open("/lib/x86_64-linux-gnu/libresolv.so.2", O_RDONLY|O_CLOEXEC) = 3
[pid 30702] open("/usr/local/lib/libdb-5.1.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT 
(No such file or directory)
[pid 30702] open("/usr/lib/libdb-5.1.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No 
such file or directory)
[pid 30702] open("/usr/lib/x86_64-linux-gnu/libdb-5.1.so", O_RDONLY|O_CLOEXEC) 
= 3
[pid 30702] open("/usr/local/lib/libbz2.so.1.0", O_RDONLY|O_CLOEXEC) = -1 
ENOENT (No such file or directory)
[pid 30702] open("/usr/lib/libbz2.so.1.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No 
such file or directory)
[pid 30702] open("/lib/x86_64-linux-gnu/libbz2.so.1.0", O_RDONLY|O_CLOEXEC) = 3
[pid 30702] open("/usr/local/lib/libpcre.so.3", O_RDONLY|O_CLOEXEC) = -1 ENOENT 
(No such file or directory)
[pid 30702] open("/usr/lib/libpcre.so.3", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No 
such file or directory)
[pid 30702] open("/lib/x86_64-linux-gnu/libpcre.so.3", O_RDONLY|O_CLOEXEC) = 3
[pid 30702] open("/usr/local/lib/libm.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT 
(No such file or directory)
[pid 30702] open("/usr/lib/libm.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such 
file or directory)
[pid 30702] open("/lib/x86_64-linux-gnu/libm.so.6", O_RDONLY|O_CLOEXEC) = 3
[pid 30702] open("/usr/local/lib/libdl.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT 
(No such file or directory)
[pid 30702] open("/usr/lib/libdl.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No 
such file or directory)
[pid 30702] open("/lib/x86_64-linux-gnu/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
[pid 30702] open("/usr/local/lib/libssl.so.1.0.0", O_RDONLY|O_CLOEXEC) = -1 
ENOENT (No such file or directory)
[pid 30702] open("/usr/lib/libssl.so.1.0.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT 
(No such file or directory)
[pid 30702] open("/lib/x86_64-linux-gnu/libssl.so.1.0.0", O_RDONLY|O_CLOEXEC) = 
3
[pid 30702] open("/usr/local/lib/libcrypto.so.1.0.0", O_RDONLY|O_CLOEXEC) = -1 
ENOENT (No such file or directory)
[pid 30702] open("/usr/lib/libcrypto.so.1.0.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT 
(No such file or directory)
[pid 30702] open("/lib/x86_64-linux-gnu/libcrypto.so.1.0.0", 
O_RDONLY|O_CLOEXEC) = 3
[pid 30702] open("/usr/local/lib/libxml2.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT 
(No such file or directory)
[pid 30702] open("/usr/lib/libxml2.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No 
such file or directory)
[pid 30702] open("/usr/lib/x86_64-linux-gnu/libxml2.so.2", O_RDONLY|O_CLOEXEC) 
= 3
[pid 30702] open("/usr/local/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT 
(No such file or directory)
[pid 30702] open("/usr/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such 
file or directory)
[pid 30702] open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
[pid 30702] open("/usr/local/lib/libpthread.so.0", O_RDONLY|O_CLOEXEC) = -1 
ENOENT (No such file or directory)
[pid 30702] open("/usr/lib/libpthread.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT 
(No such file or directory)
[pid 30702] open("/lib/x86_64-linux-gnu/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 
3
[pid 30702] open("/dev/urandom", O_RDONLY) = 3
[pid 30702] open("/dev/urandom", O_RDONLY) = 3
[pid 30702] open("/dev/urandom", O_RDONLY) = 3
[pid 30702] open("/dev/urandom", O_RDONLY) = 3
[pid 30702] open("/dev/urandom", O_RDONLY) = 3
[pid 30702] open("/etc/localtime", O_RDONLY|O_CLOEXEC) = 3
[pid 30702] open("./php-cgi-fcgi.ini", O_RDONLY) = -1 ENOENT (No such file or 
directory)
[pid 30702] open("/usr/bin/php-cgi-fcgi.ini", O_RDONLY) = -1 ENOENT (No such 
file or directory)
[pid 30702] open("/etc/php5/cgi/php-cgi-fcgi.ini", O_RDONLY) = -1 ENOENT (No 
such file or directory)
[pid 30702] open("./php.ini", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 30702] open("/usr/bin/php.ini", O_RDONLY) = -1 ENOENT (No such file or 
directory)
[pid 30702] open("/etc/php5/cgi/php.ini", O_RDONLY) = 3
[pid 30702] open("/etc/php5/cgi/conf.d/fredir.ini", O_RDONLY) = 3
[pid 30702] open("/etc/php5/cgi/conf.d/pdo.ini", O_RDONLY) = 3
[pid 30702] open("/usr/lib/php5/20090626/pdo.so", O_RDONLY|O_CLOEXEC) = 3
[pid 30702] open("/etc/nsswitch.conf", O_RDONLY|O_CLOEXEC) = 3
[pid 30702] open("/usr/local/lib/libnss_db.so.2", O_RDONLY|O_CLOEXEC) = -1 
ENOENT (No such file or directory)
[pid 30702] open("/usr/lib/libnss_db.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No 
such file or directory)
[pid 30702] open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
[pid 30702] open("/lib/x86_64-linux-gnu/tls/x86_64/libnss_db.so.2", 
O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 30702] open("/lib/x86_64-linux-gnu/tls/libnss_db.so.2", 
O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 30702] open("/lib/x86_64-linux-gnu/x86_64/libnss_db.so.2", 
O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 30702] open("/lib/x86_64-linux-gnu/libnss_db.so.2", O_RDONLY|O_CLOEXEC) = 
-1 ENOENT (No such file or directory)
[pid 30702] open("/usr/lib/x86_64-linux-gnu/tls/x86_64/libnss_db.so.2", 
O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 30702] open("/usr/lib/x86_64-linux-gnu/tls/libnss_db.so.2", 
O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 30702] open("/usr/lib/x86_64-linux-gnu/x86_64/libnss_db.so.2", 
O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 30702] open("/usr/lib/x86_64-linux-gnu/libnss_db.so.2", 
O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 30702] open("/lib/tls/x86_64/libnss_db.so.2", O_RDONLY|O_CLOEXEC) = -1 
ENOENT (No such file or directory)
[pid 30702] open("/lib/tls/libnss_db.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No 
such file or directory)
[pid 30702] open("/lib/x86_64/libnss_db.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT 
(No such file or directory)
[pid 30702] open("/lib/libnss_db.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No 
such file or directory)
[pid 30702] open("/usr/lib/libnss_db.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No 
such file or directory)
[pid 30702] open("/usr/local/lib/libnss_files.so.2", O_RDONLY|O_CLOEXEC) = -1 
ENOENT (No such file or directory)
[pid 30702] open("/usr/lib/libnss_files.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT 
(No such file or directory)
[pid 30702] open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
[pid 30702] open("/lib/x86_64-linux-gnu/libnss_files.so.2", O_RDONLY|O_CLOEXEC) 
= 3
[pid 30702] open("/etc/protocols", O_RDONLY|O_CLOEXEC) = 3
[pid 30702] open("/etc/protocols", O_RDONLY|O_CLOEXEC) = 3
[pid 30702] open("/dev/urandom", O_RDONLY) = 3
[pid 30702] open("/dev/urandom", O_RDONLY) = 3
[pid 30702] open("/dev/urandom", O_RDONLY) = 3
[pid 30702] open("/var/www/cgi-bin/test.php", O_RDONLY) = 3
[pid 30702] open("/dev/urandom", O_RDONLY) = 3
[pid 30702] open("/dev/urandom", O_RDONLY) = 3
[pid 30702] open("/dev/urandom", O_RDONLY) = 3

Perhaps your code or the way you have configured PHP and/or Apache is
causing this? Perhaps you could attach your configs and a sample of code
that causes this.

Anyway, CGI is perhaps the worst way to run PHP as it is extremely
inefficient to fork and run a new process every request. If you want
per-user PHP I'd suggest using php5-fpm and running one daemon per user.

Marking Incomplete pending response to the question about configs.

** Changed in: php5 (Ubuntu)
   Importance: Undecided => Medium

** Changed in: php5 (Ubuntu)
       Status: New => Incomplete

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1023591

Title:
  php5 opens /proc/XXX/auxv thousands of times until Apache crashes with
  "too many open files"

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/php5/+bug/1023591/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to