#36479 [Fbk->Opn]: fread using 99% CPU in Windows with SSL Connection
| From: | joel dot washburn at gmail dot com | Date: | Thu, 23 Feb 2006 19:51:38 +0000 |
| Subject: | #36479 [Fbk->Opn]: fread using 99% CPU in Windows with SSL Connection | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-93586@lists.php.net to get a copy of this message | ||
ID: 36479
User updated by: joel dot washburn at gmail dot com
Reported By: joel dot washburn at gmail dot com
-Status: Feedback
+Status: Open
Bug Type: Sockets related
Operating System: Windows (Any)
-PHP Version: 5.1.2
+PHP Version: 5.1.3-dev
New Comment:
The issue was not resolved with 5.1.3-dev.
Previous Comments:
------------------------------------------------------------------------
[2006-02-22 08:31:57] tony2001@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5.1-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5.1-win32-latest.zip
------------------------------------------------------------------------
[2006-02-21 18:03:09] joel dot washburn at gmail dot com
Description:
------------
php.exe uses 99% CPU while polling SSL sockets for data. I can
reproduce this issue in IIS and Apache using php5isapi.dll and
php5apache2.dll.
This is a nightmare for php scripts using third party API calls via SSL
sockets. If the API call takes a few seconds to run, the CPU is maxed
out waiting on a response.
This is not an issue on linux systems.
This is not an issue on Windows using clean sockets (only SSL).
Reproduce code:
---------------
Below is a simple way to reproduce the problem with fgets():
Create two files, one (timer.php) has to be accessable from the web
(HTTP and HTTPS) and the other can be ran from the command prompt
(pingtimer.php). When you run pingtimer.php using SSL, php.exe will
stick at 99% CPU in Task Manager. When you run it using clean
sockets,
its idle while waiting for a response.
timer.php :
<?php
sleep(10);
print "<html><body>10 sec. are up!</body></html>";
?>
pingtimer.php:
<?php
//$sock = fsockopen("localhost", 80);
$sock = fsockopen("ssl://localhost", 443);
$query = "GET /timer.php HTTP/1.1\r\n";
$query .= "Host: localhost\r\n";
$query .= "Connection: Close\r\n\r\n";
fwrite($sock, $query);
while (!feof($sock)) {
echo fgets($sock, 128);
}
fclose($sock);
?>
Expected result:
----------------
CPU usage should be very little or zero while waiting for a response.
Actual result:
--------------
99% CPU usage in Windows Task Manager from php.exe while waiting on a
response.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=36479&edit=1