On Feb 22, 2009 3:53am, Mladen Turk <mturk@apache.org> wrote:
> Jeff Trawick wrote:
>
> On Sat, Feb 21, 2009 at 5:22 PM, trawick@apache.org
>
> I think there may still be feedback issues in impl_pollset_poll() with rv, *num, and *descriptors, possibly specific to  APR_POLLSET_WAKEABLE.  I don't see a testcase for that; maybe I'll get a chance to play with that soon.
>
>
> The only difference is that if only the wakeup socked was signaled
>
> the *num is set to 0, descriptors are untouched and rv is APR_EINTR.
>
> Test case would be cool. I have one, but it needs a
>
> little bit polishing.
>
>
>
>
> Meanwhile, testpoll is crashing on Leopard, and I didn't think I changed any code that affects Leopard (yet) ;)
>
>
> It passes on Darwin. Does Leopard uses kqueue as well?

yes

As it turns out, I was lucky to see it crash a couple of times in a row, as it is reproduced infrequently.

These hacks work around most intermittent testpoll failures I see on on leopard (Darwin Kernel Version 9.6.0: Mon Nov 24 17:37:00 PST 2008 ... i386), where kevent returns unexpectedly:

Index: testpoll.c
===================================================================
--- testpoll.c (revision 746597)
+++ testpoll.c (working copy)
@@ -382,6 +382,11 @@

send_msg(s, sa, 0, tc);
rv = apr_pollset_poll(pollset, 0, &num, &descs);
+ if (rv != APR_SUCCESS) {
+ /* rare glitch seen on Leopard; wait just a little longer */
+ printf(" \n DELAY %d\n ", __LINE__);
+ rv = apr_pollset_poll(pollset, apr_time_from_sec(1), &num, &descs);
+ }
ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
ABTS_INT_EQUAL(tc, 1, num);
ABTS_PTR_NOTNULL(tc, descs);
@@ -444,6 +449,11 @@

send_msg(s, sa, LARGE_NUM_SOCKETS - 1, tc);
rv = apr_pollset_poll(pollset, 0, &num, &descs);
+ if (rv != APR_SUCCESS) {
+ /* rare glitch seen on Leopard; wait just a little longer */
+ printf(" \n DELAY %d\n ", __LINE__);
+ rv = apr_pollset_poll(pollset, apr_time_from_sec(1), &num, &descs);
+ }
ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
ABTS_INT_EQUAL(tc, 1, num);
ABTS_PTR_NOTNULL(tc, descs);
@@ -607,7 +617,13 @@
send_msg(s, sa, 0, tc);
pcb.tc = tc;
pcb.count = 0;
- rv = apr_pollcb_poll(pollcb, 0, trigger_pollcb_cb, &pcb);
+ rv = apr_pollcb_poll(pollcb, 0, trigger_pollcb_cb, &pcb);
+ if (APR_STATUS_IS_TIMEUP(rv)) {
+ /* rare glitch seen on Leopard; wait just a little longer */
+ printf(" \n DELAY %d\n ", __LINE__);
+ rv = apr_pollcb_poll(pollcb, apr_time_from_sec(1), trigger_pollcb_cb,
+ &pcb);
+ }
ABTS_INT_EQUAL(tc, 0, APR_STATUS_IS_TIMEUP(rv));
ABTS_INT_EQUAL(tc, 1, pcb.count);