ID: 24629 Updated by: [EMAIL PROTECTED] Reported By: zparta at skebo dot ac Status: Closed Bug Type: Sockets related Operating System: FreeBSD 4.8 (Only!) PHP Version: 4.3.3RC2-dev Assigned To: jason New Comment:
note: you misspelled my email address in the CVS commit :( It says: "Patch submitted from [EMAIL PROTECTED]" but it should be: "Patch submitted from [EMAIL PROTECTED]" without the "r" Previous Comments: ------------------------------------------------------------------------ [2003-07-22 02:21:38] [EMAIL PROTECTED] This bug has been fixed in CVS. In case this was a PHP problem, snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. In case this was a documentation problem, the fix will show up soon at http://www.php.net/manual/. In case this was a PHP.net website problem, the change will show up on the PHP.net site and on the mirror sites in short time. Thank you for the report, and for helping us make PHP better. Verified, apparently there are severl OSs that have this problem ------------------------------------------------------------------------ [2003-07-21 10:13:09] [EMAIL PROTECTED] I will take a look at this patch tonight -Jason ------------------------------------------------------------------------ [2003-07-20 16:26:01] [EMAIL PROTECTED] here the same patch for the stream_select() --- file.c.orig Sun Jul 20 23:25:34 2003 +++ file.c Sun Jul 20 23:24:55 2003 @@ -803,8 +803,15 @@ /* If seconds is not set to null, build the timeval, else we wait indefinitely */ if (sec != NULL) { convert_to_long_ex(&sec); - tv.tv_sec = Z_LVAL_P(sec); - tv.tv_usec = usec; + + if (usec > 999999) { + tv.tv_sec = Z_LVAL_P(sec)+(usec/1000000); + tv.tv_usec = usec%1000000; + } else { + tv.tv_sec = Z_LVAL_P(sec); + tv.tv_usec = usec; + } + tv_p = &tv; } ------------------------------------------------------------------------ [2003-07-20 16:13:56] [EMAIL PROTECTED] I found the problem with the select() under freebsd, the select() checks the timeout values (sec and usec). When they exceed the max value which is on freebsd for usec 999,999, after this number it must be 1 sec and not 1,000,000 usecs. This is whats happening here, the script wants 300,000,000 usecs, which are 300 seconds. Linux doesn't care about this and accepts this number (and works fine with it). I wrote the patch and tested it on the freebsd 4.8 box, strace now shows (as expected): select(4, [3], [], [], {300, 0} Here the patch which fixes this bug: --- sockets.c.orig Tue Jul 15 08:08:02 2003 +++ sockets.c Sun Jul 20 23:01:21 2003 @@ -591,8 +591,15 @@ convert_to_long(&tmp); sec = &tmp; } - tv.tv_sec = Z_LVAL_P(sec); - tv.tv_usec = usec; + + if (usec > 999999) { + tv.tv_sec = Z_LVAL_P(sec)+(usec/1000000); + tv.tv_usec = usec%1000000; + } else { + tv.tv_sec = Z_LVAL_P(sec); + tv.tv_usec = usec; + } + tv_p = &tv; if (sec == &tmp) { ------------------------------------------------------------------------ [2003-07-20 13:47:58] [EMAIL PROTECTED] I just straced the script with stream_select() and it's also getting the "Invalid argument" error msg. select(4, [3], [], [], {0, 300000000}) = -1 EINVAL (Invalid argument) ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/24629 -- Edit this bug report at http://bugs.php.net/?id=24629&edit=1
