ID: 50312 Updated by: j...@php.net Reported By: kvr at centrum dot cz -Status: Open +Status: Feedback Bug Type: HTTP related Operating System: Linux, Debian PHP Version: 5.3SVN-2009-11-27 (snap) New Comment:
Well, did you try the short example I provided? That site isn't exactly "slow" but since you're not providing anything to work with that's what I tested and that works.. Previous Comments: ------------------------------------------------------------------------ [2009-11-27 16:57:04] kvr at centrum dot cz Well, sorry, the URL address was supposed to be replaced with anything real but preferably slow. I compiled the php5.3-latest as proposed and the problem is there as well. ------------------------------------------------------------------------ [2009-11-27 14:31:01] j...@php.net Unless of course your provided "code" is supposed to work at all? This works too: # php -r '$fd = fopen("https://master.php.net/manage/users.php", "r");' ------------------------------------------------------------------------ [2009-11-27 14:28:31] j...@php.net Please try using this snapshot: http://snaps.php.net/php5.3-latest.tar.gz For Windows: http://windows.php.net/snapshots/ Works fine for me. Try without any 3rd party patches. ------------------------------------------------------------------------ [2009-11-27 13:37:07] kvr at centrum dot cz Description: ------------ When connecting to https server using fopen("https://..."), php consumes all cpu time until the connection is established. When there is problem with the remote https server, the cpu is occupied until the script runs out of time. Full version information: PHP 5.3.0-0.dotdeb.8 with Suhosin-Patch 0.9.7 (cli) (built: Aug 12 2009 18:11:27) Reproduce code: --------------- The following code can be used to reproduce: $fd = fopen("https://whatever.com/index.html", "r") Expected result: ---------------- The code should open the connection without busy waits. Actual result: -------------- The code keeps trying reading on non-blocked socket until some data is received, see the strace: 25832 socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 38 25832 fcntl64(38, F_GETFL) = 0x2 (flags O_RDWR) 25832 fcntl64(38, F_SETFL, O_RDWR|O_NONBLOCK) = 0 25832 connect(38, {sa_family=AF_INET, sin_port=htons(443), sin_addr=inet_addr("w.x.y.z")}, 16) = -1 EINPROGRESS (Operation now in progress) 25832 poll([{fd=38, events=POLLIN|POLLOUT|POLLERR|POLLHUP}], 1, 60000 <unfinished ...> 25832 <... poll resumed> ) = 1 ([{fd=38, revents=POLLOUT}]) 25832 getsockopt(38, SOL_SOCKET, SO_ERROR, [0], [4]) = 0 25832 fcntl64(38, F_SETFL, O_RDWR) = 0 25832 fcntl64(38, F_GETFL) = 0x2 (flags O_RDWR) 25832 fcntl64(38, F_SETFL, O_RDWR|O_NONBLOCK) = 0 25832 gettimeofday({1259327624, 794801}, {4294967176, 0}) = 0 25832 time(NULL) = 1259327624 25832 time(NULL) = 1259327624 25832 write(38, "\200d\1\3\1\0K\0\0\0\20\0\0009\0\0008\0\0005\0\0\26\0\0\23\0\0\n\7\0 0\200\0\0\25\0\0\22\0\0\t\...@\0\0\24\0\0\21\0\0\10\0\0\6\4\0\200\0\0 25832 read(38, 0x8e62f78, 7) = -1 EAGAIN (Resource temporarily unavailable) 25832 gettimeofday({1259327624, 795389}, {4294967176, 0}) = 0 25832 gettimeofday({1259327624, 795463}, {4294967176, 0}) = 0 25832 time(NULL) = 1259327624 25832 read(38, 0x8e62f78, 7) = -1 EAGAIN (Resource temporarily unavailable) ... read repeats many times / or forever instead of polling socket for POLLIN. 25832 read(38, 0x8e62f78, 5) = -1 EAGAIN (Resource temporarily unavailable) 25832 gettimeofday({1259327624, 893179}, {4294967176, 0}) = 0 25832 gettimeofday({1259327624, 893222}, {4294967176, 0}) = 0 25832 time(NULL) = 1259327624 25832 read(38, "\24\3\1\0\1", 5) = 5 When / if the data is received, the communication continues correctly. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=50312&edit=1