Edit report at http://bugs.php.net/bug.php?id=41932&edit=1

 ID:               41932
 Comment by:       marcelo at tpn dot com dot br
 Reported by:      yaboll at interia dot pl
 Summary:          fsockopen - apache2 poblem with many vhosts
 Status:           Bogus
 Type:             Bug
 Package:          Sockets related
 Operating System: linux
 PHP Version:      4.4.7

 New Comment:

See http://bugs.php.net/bug.php?id=39803


Previous Comments:
------------------------------------------------------------------------
[2007-07-10 08:03:14] yaboll at interia dot pl

There is no nfile limit in apache server.

When i change nfile limit I have the same results (error or seqfault) 



Limit are set to unlimited/high value intentionally for this test:



This is results in 

system('ulimit -a');



core file size (blocks, -c) unlimited

data seg size (kbytes, -d) unlimited

file size (blocks, -f) unlimited

max locked memory (kbytes, -l) unlimited

max memory size (kbytes, -m) unlimited

open files (-n) 1048576

pipe size (512 bytes, -p) 8

stack size (kbytes, -s) 8192

cpu time (seconds, -t) unlimited

max user processes (-u) unlimited

virtual memory (kbytes, -v) 250000







I would like to emphasize that when I use php 5.2 everything works fine
within the same limits/apache2 config.





The problem is connected with php 4.4.7 in mod_php.



When i use 4.4.7 in cgi, or php 5.2 in mod_php (same ulimit and apache2
config) or 5.2 in cgi mode script return good results.

------------------------------------------------------------------------
[2007-07-09 20:32:22] tony2...@php.net

You've run into your system's file descriptor limit.

Not PHP problem.

------------------------------------------------------------------------
[2007-07-09 08:10:19] yaboll at interia dot pl

Well, as this bug is version 4.4.7 related, I hope that this is some
kind of automatic reply :D

Downloading 5.2 will solve the problem, but it would be nice to see it
corrected in php4.

------------------------------------------------------------------------
[2007-07-09 07:53:00] der...@php.net

Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows (zip):
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip

For Windows (installer):

  http://snaps.php.net/win32/php5.2-win32-installer-latest.msi

------------------------------------------------------------------------
[2007-07-09 07:43:44] yaboll at interia dot pl

Description:
------------
I found problem in fsockopen() when I use php as module mod_php in
apache2.



When I create many vhost fsckopen() doesn't work good and generate child
sigterm error.



I made some experimets with vhost number:



vhosts number - error



less than 1005 - work fine

1006-1007 - white page (no error)

1008 - around 1164 - "Operation now in progress (115)"

around 1150 - around 1164 - "Bad file descriptor (9)"

around 1164 - around 1200 - "Operation now in progress (115)"

1200 and more - apache child sigterm







core in sigterm:

(gdb) bt

#0 php_hostconnect (host=Cannot access memory at address 0xc

) at /srv/dev-dev/php4-debug/php4/php4-4.4.7/main/network.c:490

Cannot access memory at address 0x4

(gdb)





When I use php in cgi/cli mode all works fine.

Reproduce code:
---------------
<?php

 $fp = fsockopen("www.onet.pl", 80, $errno, $errstr, 30);

 if (!$fp) {

  echo "$errstr ($errno)<br />\n";

 } else {

   $out = "GET / HTTP/1.1\r\n";

   $out .= "Host: www.onet.pl\r\n";

   $out .= "Connection: Close\r\n\r\n";

   fwrite($fp, $out);

   while (!feof($fp)) {

    echo fgets($fp, 128);

   }

   fclose($fp);

 }

?>



------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=41932&edit=1

Reply via email to