php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56377 stream_set_timeout() doesn't work
Submitted: 2005-04-21 09:55 UTC Modified: 2012-06-19 18:24 UTC
From: spookyfish at tweakdsl dot nl Assigned: langemeijer (profile)
Status: Closed Package: ssh2 (PECL)
PHP Version: 5_0 CVS-2005-04-21 (dev) OS: SuSE 9.0
Private report: No CVE-ID: None
 [2005-04-21 09:55 UTC] spookyfish at tweakdsl dot nl
Description:
------------
stream_set_timeout() doesn't seem to work on a blocking ssh2_exec() stream.

Reproduce code:
---------------
$con=ssh2_connect('ssss', 22);
ssh2_auth_password($con, "xxx", "yyy");
$exec = ssh2_exec($con, '/path/to/application');
$a = microtime(TRUE);
stream_set_blocking($exec, TRUE);
stream_set_timeout($exec, 1);
$buffer = trim(fgets($exec));
if (empty($buffer)) {
	$buffer = "EMPTY";
}
echo "Result: $buffer in " . round((microtime(TRUE) - $a)*1000, 1) . "ms";


Expected result:
----------------
EMPTY after ~ sec

Actual result:
--------------
Example code will stall >1 sec if the executable executes a sleep(10);

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-06-10 19:42 UTC] casper at langemeijer dot eu
I'm working on getting this fixed. For a clean solution, this requires a change 
in the libssh2 library. I've sent them a patch and we'll see what the outcome 
will be.
 [2012-06-13 18:55 UTC] langemeijer@php.net
-Assigned To: +Assigned To: langemeijer
 [2012-06-19 18:13 UTC] langemeijer@php.net
Automatic comment from SVN on behalf of langemeijer
Revision: http://svn.php.net/viewvc/?view=revision&revision=326254
Log: Add support for stream_set_timeout() to channel streams - Fixes bug #56377
 [2012-06-19 18:24 UTC] langemeijer@php.net
-Status: Assigned +Status: Closed
 [2012-06-19 18:24 UTC] langemeijer@php.net
This issue is fixed in SVN, the change in libssh2 was not required.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Tue Nov 12 08:01:35 2019 UTC