#50737 [Fbk->Opn]: stream_set_blocking creates high cpu usage
ID: 50737
User updated by: jason at lentink dot net
Reported By: jason at lentink dot net
-Status: Feedback
+Status: Open
Bug Type: Streams related
Operating System: Linux
PHP Version: 5.2.12
New Comment:
I could provide you guys with a small script
bug i can also point you to the place where the problem exists since
it happens in Zend Framework.
http://framework.zend.com/svn/framework/standard/trunk/library/Zend/Queu
e/Stomp/Client/Connection.php
The function is used at line 79. What i see on my servers is that when
there are simultaneous request made to the same script the problem
increases more rapidly.
Previous Comments:
------------------------------------------------------------------------
[2010-01-13 12:07:10] jani@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc. If the script requires a
database to demonstrate the issue, please make sure it creates
all necessary tables, stored procedures etc.
Please avoid embedding huge scripts into the report.
------------------------------------------------------------------------
[2010-01-13 09:58:52] jason at lentink dot net
Description:
------------
When using stream_set_blocking on a stream will create a huge load on
cpu. When using this function it uses up to 50% of the cpu. When not
using this function it will only use 0.1% cpu usage.
Reproduce code:
---------------
$this->_socket = fsockopen($str, $port, $errno, $errstr);
stream_set_blocking($this->_socket, 0); // non blocking
Expected result:
----------------
An socket which will be opened fast. in a non-blocking mode.
Actual result:
--------------
An open socket. But the cpu use is enormous.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=50737&edit=1
Thread (9 messages)