|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-08-19 01:27 UTC] drew at drewb dot com
Description:
------------
Using pecl ssh2 ver 0.10
Every so often (once every 300 or more runs) my script ends in a php fatal error w/ max_execution_time reached. The line pointed to by the logged error message indicates that ssh2_connect() is hung waiting for a reply from the remote host. I would have expected the attempt to connect to have failed after a timeout.
I'm not certain yet if this is due to libssh2 or pecl ssh2.
I will try to follow up with more info and some testing, but it's difficult to set up.
Reproduce code:
---------------
<?php
$conn = ssh2_connect($remote_host, $port);
/*
* script fails to reach this point before
* max_execution_time.
*/
if ( ! $conn )
{
die("failed to connect to $remote_host on $port.");
}
Expected result:
----------------
sshs_connect returns false after tv seconds.
script dies w/ error message.
Actual result:
--------------
php fatal error (max_execution_time reached).
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 13:00:01 2025 UTC |
We are experiencing this on a daily basis, but only on the attempt to connect to one of our customers' SFTP server. The strace log is below, the call to poll never returns. The other instances where the poll call returns look like " 13:05:15 poll([{fd=18, events=POLLIN}], 1, -1) = 1 ([{fd=18, revents=POLLIN}])" 13:05:16 socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 18 13:05:16 fcntl(18, F_GETFL) = 0x2 (flags O_RDWR) 13:05:16 fcntl(18, F_SETFL, O_RDWR|O_NONBLOCK) = 0 13:05:16 connect(18, {sa_family=AF_INET, sin_port=htons(22), sin_addr=inet_addr("38.101.40.53")}, 16) = -1 EINPROGRESS (Operation now in progress) 13:05:16 poll([{fd=18, events=POLLIN|POLLOUT|POLLERR|POLLHUP}], 1, 60000) = 1 ([{fd=18, revents=POLLOUT}]) 13:05:16 getsockopt(18, SOL_SOCKET, SO_ERROR, [0], [4]) = 0 13:05:16 fcntl(18, F_SETFL, O_RDWR) = 0 13:05:16 fcntl(18, F_GETFL) = 0x2 (flags O_RDWR) 13:05:16 fcntl(18, F_GETFL) = 0x2 (flags O_RDWR) 13:05:16 fcntl(18, F_SETFL, O_RDWR|O_NONBLOCK) = 0 13:05:16 sendto(18, "SSH-2.0-libssh2_1.2.6 PHP\r\n", 27, MSG_NOSIGNAL, NULL, 0) = 27 13:05:16 recvfrom(18, 0x7fffdc6b645f, 1, 16384, 0, 0) = -1 EAGAIN (Resource temporarily unavailable) 13:05:16 poll([{fd=18, events=POLLIN}], 1, -1