Open
Bug 192797
Opened 22 years ago
Updated 2 years ago
PR_Poll times out when it shouldn't (win9x only)
Categories
(NSPR :: NSPR, defect)
Tracking
(Not tracked)
NEW
People
(Reporter: darin.moz, Unassigned)
Details
Attachments
(1 file, 2 obsolete files)
|
3.32 KB,
patch
|
Details | Diff | Splinter Review |
from bug 192294, PR_Poll under Win9x sometimes times out (returns 0) when passed
PR_INTERVAL_NO_TIMEOUT. from my investigation, it appears that the bug exists
in the OS (_MD_SELECT is returning 0 when tvp == NULL). i tried adding a
do-while loop around _MD_SELECT, like this:
do {
ready = _MD_SELECT(..., tvp);
} while (ready == 0 && tvp == NULL);
but when we loop, the second _MD_SELECT call errors out with WINSOCK error 10023
"Too many open files". i'm a bit suspicious of this error code, since i would
have expected the first call to _MD_SELECT to return this error if it is indeed
the problem.
Comment 1•22 years ago
|
||
10023 does not seem to be a Winsock error. At
least it is not defined in <winsock2.h>. Could
you tell me where it is defined?
I suspect that the first call to _MD_SELECT
modified the fd_sets, so we can't call _MD_SELECT
on them again. I will attach a patch for you to
try.
Comment 2•22 years ago
|
||
This patch calls select() again if select() times out
when we ask it not to. Please test this patch with
this printf statement after the _MD_SELECT() call:
printf("select with timeout %p returned %d, error %d\n",
tvp, ready, (ready == SOCKET_ERROR) ? WSAGetLastError() : 0);
Comment 3•22 years ago
|
||
This version is slightly better.
Attachment #114181 -
Attachment is obsolete: true
Comment 4•22 years ago
|
||
This patch addresses all the issues I found reading
the Winsock select() documentation.
1. Increase FD_SETSIZE to 1024. (The default value of
FD_SETSIZE is only 64.) Make PR_Poll fail with
PR_INSUFFICIENT_RESOURCES_ERROR if we try to add more
sockets to the fd_set structures than they can hold.
2. Pass a pointer to a fd_set structure to select()
only if the fd_set contains at least a socket.
3. If all three fd_set structures are empty, simply
do a sleep with the specified timeout and return 0.
Please test this patch with the printf statement (see
comment 2) after the _MD_SELECT() call. Thanks.
Attachment #114183 -
Attachment is obsolete: true
| Reporter | ||
Comment 5•22 years ago
|
||
i should point out that this bug always seems to occur when necko is polling
only for exceptions on a large number of sockets (~20 or so). i'll give your
patch a try shortly ;-)
| Reporter | ||
Comment 6•22 years ago
|
||
oh, i should have said... though necko is polling a bunch of sockets for
PR_POLL_EXCEPT only, there is still the "pollable event" that is being polled
for PR_POLL_READ. so, actually my comment above is not quite correct.
i don't know whether it has anything to do with this but i'll state it anyway:
back when i was programming the w3c wwwlib, i had to 'fix up' some loop when it
was running on Windows NT. when trying to clear some fd_set with FD_CLR it
sometimes failed to clear!
so i wrapped it up in a while loop and had one less 'bug' to worry about in the
Win32 winsock library.
see http://lists.w3.org/Archives/Public/www-lib/2000AprJun/0124.html
Comment 8•22 years ago
|
||
Mrten:
Thanks for the pointer to your bug fix. Our code is not
using FD_CLR (we use FD_ZERO, FD_SET, and FD_ISSET), so
the bug we are running into is not the same one.
Comment 9•22 years ago
|
||
So, is this patch good? Can it be approved and committed before 1.3 final?
This seems simple enough that it can be put in, yes?
| Reporter | ||
Comment 10•22 years ago
|
||
chris: we've worked around this bug in the networking code above NSPR, so this
bug is not very critical for 1.3.
Comment 11•22 years ago
|
||
Yeah, I saw that in bug #192294. But I was still figuring that this might hurt
other things, and that if there was a patch that could be moved on, it may as
well be...
Thanks...
Updated•18 years ago
|
QA Contact: wtchang → nspr
Updated•3 years ago
|
Severity: normal → S3
Comment 12•2 years ago
|
||
The bug assignee is inactive on Bugzilla, so the assignee is being reset.
Assignee: wtc → nobody
You need to log in
before you can comment on or make changes to this bug.
Description
•