php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20922 socket_select() blocks for some reason
Submitted: 2002-12-10 07:40 UTC Modified: 2003-01-02 18:45 UTC
Votes:6
Avg. Score:4.8 ± 0.4
Reproduced:3 of 3 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: tit dot petric at telemach dot net Assigned:
Status: No Feedback Package: Sockets related
PHP Version: 4.4.0-dev OS: linux debian latest unstable
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: tit dot petric at telemach dot net
New email:
PHP Version: OS:

 

 [2002-12-10 07:40 UTC] tit dot petric at telemach dot net
$r = array($network->_connection);
if (socket_select($r,$w=NULL,$e=NULL,0)===false) {
        echo "socket_select failed: reason: " . socket_strerror(socket_last_error()) . "\n";
} else {
... code...
}

somehow neither part of the if/else case gets executed for me, socket_select just seems to "hang".. the $network->_connection is valid (no errors in connecting) and non blocking (no errors here either)..

the code used to work fine for quite some time, also on 4.2.3 now i don't have a clue what goes wrong -> if i send data trough the socket i actually get it on the other side (the application here would be an irc bot, so i see him join the network and then timeout since it hangs on socket_select)

the code for it is on www.sf.net/projects/phpinfobot/ in the cvs, if somebody wants to test it, the important files should be

/infobot.php
/include/system/network.php
/include/system/irc.php

the rest is pretty much non important

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-10 07:41 UTC] derick@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip
 [2002-12-10 08:16 UTC] tit dot petric at telemach dot net
on windows i get the "same" result with 4.3rc2, just that it hangs on socket_read() not on socket_select

PHP Warning:  socket_read() unable to read from socket [10035]: A non-blocking s
ocket operation could not be completed immediately.
 in D:\respawn\phpinfobot\infobot_win.php on line 28

then it crashes and i get that microsoft "report crash" thingie..

the code related to this:

if (!socket_set_nonblock($this->_connection)) {
  report->info("couldnt set nonblocking mode.\n\n");
}

(this info line above ofcourse doesnt get printed)

as for the debian, i'm not really that much into compiling & everything, and im definetly not fond of it on a "production" server..
 [2002-12-10 09:15 UTC] sniper@php.net
Please try the snapshot, iirc, there were some fixed done
which are NOT in RC2.

 [2002-12-10 11:11 UTC] tit dot petric at telemach dot net
same result on windows rc2, just no more crash
 [2002-12-10 17:12 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip

One more try: TRY THE SNAPSHOT.
Not the RC2..(snapshot, as in the given url..)

 [2002-12-10 17:31 UTC] tit dot petric at telemach dot net
ughm sorry for my rushed english, what i ment to say is..

the snapshot version produces the same output as rc2, just without the crash.
 [2002-12-11 01:08 UTC] sniper@php.net
Please provide a complete, self-contained and short example script which can be used to reproduce this.

 [2002-12-11 06:38 UTC] tit dot petric at telemach dot net
hmm ok, here is the thing.. the script failed on socket_select - but it was from a previous error

before i did socket select i also did a file() on an url - the server was down so i guess somehow the error just got projected to another socket

without the file($url) code i cant replicate it's behaviour, so i removed it. my original report is still valid - socked_select() seemed to stop in its tracks after that invalid file($url) request. (I had debug output before and after to see why/how it hangs and i haddnt suspected file($url) since it wen't without verbosity on that part)
 [2002-12-11 08:08 UTC] sniper@php.net
Please provide a complete, self-contained and short example script which can be used to reproduce this.

complete: Begins with <?php, ends with ?> 
self-contained: Does not require anything but itself.
short: 10-15 lines.


 [2003-01-02 18:45 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 [2005-07-06 13:49 UTC] freeway at freesurf dot fr
what do you mean by
try using this CVS snapshot ?
 [2005-07-06 14:09 UTC] freeway at freesurf dot fr
I use php5 and still socket_select() still hanging
 [2007-11-28 02:14 UTC] j_kkachi at yahoo dot com
I'm having problem with socket_select() as well. Completely stops there even though UDP packets came through the port.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Oct 15 19:01:26 2024 UTC