On 3/15/06, Garrett Rooney <[EMAIL PROTECTED]> wrote:
> On 3/15/06, Joe Orton <[EMAIL PROTECTED]> wrote:
>
> > Returning two separate descriptors should be valid behaviour, the test
> > just needs to be adjusted to handle that case; it'll still catch the bug
> > in the select() backend. Can you try this patch?
>
> Tried on FreeBSD:
>
> > Index: testpoll.c
> > ===================================================================
> > --- testpoll.c (revision 385518)
> > +++ testpoll.c (working copy)
> > @@ -309,10 +309,25 @@
> >
> > rv = apr_pollset_poll(pollset, 0, &lrv, &descs);
> > ABTS_INT_EQUAL(tc, 0, APR_STATUS_IS_TIMEUP(rv));
> > - ABTS_INT_EQUAL(tc, 1, lrv);
> > - ABTS_PTR_EQUAL(tc, s[0], descs[0].desc.s);
> > - ABTS_INT_EQUAL(tc, APR_POLLIN | APR_POLLOUT, descs[0].rtnevents);
> > - ABTS_PTR_EQUAL(tc, s[0], descs[0].client_data);
> > + if (lrv == 1) {
> > + ABTS_PTR_EQUAL(tc, s[0], descs[0].desc.s);
> > + ABTS_INT_EQUAL(tc, APR_POLLIN | APR_POLLOUT, descs[0].rtnevents);
> > + ABTS_PTR_EQUAL(tc, s[0], descs[0].client_data);
> > + }
> > + else if (lrv == 2) {
> > + ABTS_PTR_EQUAL(tc, s[0], descs[0].desc.s);
> > + ABTS_PTR_EQUAL(tc, s[0], descs[0].client_data);
> > + ABTS_PTR_EQUAL(tc, s[0], descs[1].desc.s);
> > + ABTS_PTR_EQUAL(tc, s[0], descs[1].client_data);
> > + ABTS_ASSERT(tc, "returned events incorrect",
> > + ((descs[0].rtnevents | descs[1].rtnevents)
> > + == (APR_POLLIN | APR_POLLOUT))
> > + && descs[0].rtnevents != descs[1].rtnevents);
>
> This fails because both rtnevents are actually APR_POLLIN | APR_POLLOUT.
>
> > + }
> > + else {
> > + ABTS_ASSERT(tc, "either one or two events returned",
> > + lrv == 1 || lrv == 2);
> > + }
> >
> > recv_msg(s, 0, p, tc);
> >
>
> If we get past that point, we later fail because at the line:
>
> ABTS_INT_EQUAL(tc, APR_POLLOUT, descs[0].rtnevents);
>
> The rtnevents is again APR_POLLIN | APR_POLLOUT. Not clear why that's
> the case, but there we have it...
Figured it out. See r386154 for the fix. Long standing bug in the
kqueue code. Will backport to 1.2.x real soon now.
-garrett