Since NetWare does not have an implementation of the poll() api, we
are obviously using the select() version of apr_poll().  When I run the
APR testpoll test it fails on the "send_2_signaled_1" test.  After doing
some research this is what I have discovered.  During the flow of
testpoll 3 sockets are created and put in to the poll array.  The
following is the expected state of the sockets at the time apr_poll() is
called during each test.

test                                0             1              2
------------------------------------------------------
send_2                       nodata    nodata    data
recv_2_send_1          nodata    data        nodata
send_2_signaled_1    nodata    data        data               test
fails detecting no data on "2"


The "send_2" test sends data to socket "2" followed by the
"recv_2_send_1" test which recieves the data from socket "2" and then
sends data on socket "1".  At this point we have no data on socket "0",
data on socket "1" and no data on socket "2".  Everything is fine at
this point.  In the next test "send_2_signaled_1" sends data to socket
"2" immediately before calling apr_poll().  The expectation is that
apr_poll() will return with recv events on socket "1" and socket "2". 
The issues is that when select() is called in apr_poll(), it returns
immediately signalling that there is data on socket "1" but no data on
socket "2".  The reason why is because the data for socket "2" that was
sent immediately before calling apr_poll(), has not had enough time to
be recognized by select() yet.  select() did not wait for the recv event
on socket "2" because it already had something to report on socket "1". 
In every other case previous to this, there where no events pending so
select() waited from an event.  In this case there was already an event
pending on socket "1" so select() never bothered waiting for the event
on socket "2".  The test expects both socket "1" and socket "2" to have
pending recv events but fails.  Does the same issue exist in the poll()
implementation of apr_poll()?  Is this a bug in the test or in
apr_poll()?

Brad

Brad

Brad Nicholes
Senior Software Engineer
Novell, Inc., the leading provider of Net business solutions
http://www.novell.com 

Reply via email to