php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67471 fpm slow log && fsockopen :Operation now in progress
Submitted: 2014-06-19 07:56 UTC Modified: 2014-06-19 08:25 UTC
Votes:7
Avg. Score:3.9 ± 0.8
Reproduced:6 of 6 (100.0%)
Same Version:3 (50.0%)
Same OS:3 (50.0%)
From: imsiren at 163 dot com Assigned:
Status: Open Package: FPM related
PHP Version: 5.4.29 OS: Centos 5.5
Private report: No CVE-ID: None
 [2014-06-19 07:56 UTC] imsiren at 163 dot com
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"

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-06-19 08:25 UTC] imsiren at 163 dot com
-Summary: fpm slow log && fsockopen :Operation now in progress +Summary: fpm slow log && fsockopen :Operation now in progress
 [2014-06-19 08:25 UTC] imsiren at 163 dot com
modify summary.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Oct 12 16:01:26 2024 UTC