#50737 [Opn-Fbk]: stream_set_blocking creates high cpu usage

2010-01-14 Thread jani
 ID:   50737
 Updated by:   j...@php.net
 Reported By:  jason at lentink dot net
-Status:   Open
+Status:   Feedback
 Bug Type: Streams related
 Operating System: Linux
 PHP Version:  5.2.12
 New Comment:

I asked for small, complete script NOT for a framework.


Previous Comments:


[2010-01-14 12:13:36] jason at lentink dot net

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.



[2010-01-13 12:07:10] j...@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=50737edit=1



#50737 [Opn-Fbk]: stream_set_blocking creates high cpu usage

2010-01-13 Thread jani
 ID:   50737
 Updated by:   j...@php.net
 Reported By:  jason at lentink dot net
-Status:   Open
+Status:   Feedback
-Bug Type: Sockets related
+Bug Type: Streams related
 Operating System: Linux
 PHP Version:  5.2.12
 New Comment:

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.




Previous Comments:


[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=50737edit=1