ID:               50866
 Updated by:       j...@php.net
 Reported By:      nj506 at zepler dot net
-Status:           Open
+Status:           Feedback
 Bug Type:         Streams related
 Operating System: Linux
 PHP Version:      5.3.1
 New Comment:

Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/




Previous Comments:
------------------------------------------------------------------------

[2010-01-27 22:14:18] nj506 at zepler dot net

Description:
------------
stream_socket_enable_crypto() hangs for unnegotiable SSL connections
for sockets connected in asynchronous mode.

Whilst I'm not greatly familiar with the PHP source, I believe it is
caused by the following line of code in xp_ssl.c:

timeout -= (tve.tv_sec + (float) tve.tv_usec / 1000000) - (tvs.tv_sec +
(float) tvs.tv_usec / 1000000);

I'm often seeing no difference in tve.tv_sec and tvs.tv_sec, and the
difference between tve.tv_usec and tvs.tv_usec is typically 4/5
microseconds for the particular scenario I've been debugging. 4/1000000
deduction from the timeout float results in essentially no change.
Therefore the code loops for a very long time. In anycase, a printf on
the timeout float see's no change after running for a good length of
time.

Note: I don't believe this is the same issue as #45808, since this
affects client connections, not server connections [+ the area of code I
believe to be guilty is specific to client connections]

I'd also note that stream_set_blocking appears to have no effect on
this area of code - but I'm not sure if thats a bug or not.

Reproduce code:
---------------
<?PHP

// The given address should not be connectable..

$socket = stream_socket_client("tcp://{$address}", $errno, $errstr, 15,
STREAM_CLIENT_CONNECT|STREAM_CLIENT_ASYNC_CONNECT);
var_dump(stream_socket_enable_crypto($socket, true,
STREAM_CRYPTO_METHOD_SSLv23_CLIENT));

?>

Expected result:
----------------
0/false [after "timeout" seconds]

Actual result:
--------------
Hangs pretty much forever.


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


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

Reply via email to