Bug #67471 [NEW]: fpm slow log && fsockopen ï¼Operation now in progress
| From: | imsiren at 163 dot com | Date: | Thu, 19 Jun 2014 07:56:22 +0000 |
| Subject: | Bug #67471 [NEW]: fpm slow log && fsockopen ï¼Operation now in progress | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-186247@lists.php.net to get a copy of this message | ||
From: imsiren at 163 dot com
Operating system: Centos 5.5
PHP version: 5.4.29
Package: FPM related
Bug Type: Bug
Bug description:fpm slow log && fsockopen ï¼Operation now in progress
Description:
------------
Hello :
There is a err in my script, When fpm open slowlog,the
"request_slowlog_timeout " sets 3 seconds,"request_terminate_timeout" is
10 seconds, I try to connect a web url use fsockopen,if the web url can
not arrived because of some error, the fsockopen will return "Operation
now in progress",I know ,that mean is the socket trying to connect that
web url in non-block,although return,but in connection.
If used php client execute the same script,that will be return "Connect
Time out",so the problem only in fpm.
I try to read fpm source code, find the reasonï¼
fpm has a master progress to manage child progresses,fsockopen open
a error url(or can not arrived ),the progress will be block in connect
until connect time out,php script running slowly that will be trigger
master progress write slow log,in this time, master progress will send
SIGSTOP signal to child progress that will be stop the child
progress,then master progress write slow log or trace info, this done,
master progress will send SIGCONT signal to the stoped child
progress,then child progress will be continue running, in this time,
child progress should be block in connect, but ,in fact not this,connect
will return immediately,then call error() will return 'Operation now in
progress'.
sorry ,I dont know whether you can understand me, is this a bug or
error?
Test script:
---------------
<?php
$url="1.2.3.2";
$fp = fsockopen($url, 9890, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
$out = "GET / HTTP/1.1\r\n";
$out .= "Host: $url\r\n";
$out .= "Connection: Close\r\n\r\n";
fwrite($fp, $out);
while (!feof($fp)) {
echo fgets($fp, 128);
}
fclose($fp);
}
?>
Expected result:
----------------
fsockopen should be return "connect time out", not "Operation now in
progress".
Actual result:
--------------
fsockopen return "Operation now in progress"
--
Edit bug report at https://bugs.php.net/bug.php?id=67471&edit=1
--