You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by jo...@apache.org on 2005/05/25 08:24:20 UTC

svn commit: r178386 - /apr/apr/trunk/build/apr_hints.m4

Author: jorton
Date: Tue May 24 23:24:19 2005
New Revision: 178386

URL: http://svn.apache.org/viewcvs?rev=178386&view=rev
Log:
* build/apr_hints.m4 (APR_PRELOAD): Prevent use of poll() on Darwin.

PR: 34332, 29985

Modified:
    apr/apr/trunk/build/apr_hints.m4

Modified: apr/apr/trunk/build/apr_hints.m4
URL: http://svn.apache.org/viewcvs/apr/apr/trunk/build/apr_hints.m4?rev=178386&r1=178385&r2=178386&view=diff
==============================================================================
--- apr/apr/trunk/build/apr_hints.m4 (original)
+++ apr/apr/trunk/build/apr_hints.m4 Tue May 24 23:24:19 2005
@@ -189,6 +189,8 @@
     *-apple-darwin*)
 	APR_ADDTO(CPPFLAGS, [-DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK -no-cpp-precomp])
 	APR_SETIFNULL(apr_posixsem_is_global, [yes])
+        # http://issues.apache.org/bugzilla/show_bug.cgi?id=34332
+        APR_SETIFNULL(ac_cv_func_poll, [no])
 	;;
     *-dec-osf*)
 	APR_ADDTO(CPPFLAGS, [-DOSF1])



Re: svn commit: r178386 - /apr/apr/trunk/build/apr_hints.m4

Posted by Joe Orton <jo...@redhat.com>.
On Wed, May 25, 2005 at 12:10:41AM -0700, Paul Querna wrote:
> Joe Orton wrote:
> >>This could all be mute if we added a KQueue backend for apr_poll().  I
> >>had the code to do it at one time, I will look at adding it later this week.
> > 
> > apr_poll() is not used by apr_wait_for_io_or_timeout().
> > 
> 
> Yep. It uses poll() directly, or a pollset.  Maybe we should just
> preload WAITIO_USES_POLL to 0 on darwin, instead of killing poll completely?

Either it's broken or it's not, let's decide on one and at least be
consistent ;)

> > But making apr_poll() use a kqueue-like interface is a really bad idea
> > anyway, as I've argued before.  apr_poll() should be efficient to use
> > occasionally or for small numbers of fds; and will be necessarily faster
> > than apr_pollset_* in those cases since it requires just one system call
> > - no overhead for setting up and tearing down the kqueue/epoll/... 
> > interface.
> 
> Perhaps, but if they could be cached, and re-used, it is faster if we
> will be doing it multiple times.  

The apr_poll() interface doesn't allow that; that's the whole point. 
This is a feature not a bug.  One size does not fit all.  etc ;)

> On FreeBSD, I commonly saw kqueue to have about 20% lower latency than
> poll().

With a single fd in the pollset?

joe

Re: svn commit: r178386 - /apr/apr/trunk/build/apr_hints.m4

Posted by Paul Querna <ch...@force-elite.com>.
Joe Orton wrote:
> On Tue, May 24, 2005 at 11:28:50PM -0700, Paul Querna wrote:
> 
>>jorton@apache.org wrote:
>>
>>>Author: jorton
>>>Date: Tue May 24 23:24:19 2005
>>>New Revision: 178386
>>>
>>>URL: http://svn.apache.org/viewcvs?rev=178386&view=rev
>>>Log:
>>>* build/apr_hints.m4 (APR_PRELOAD): Prevent use of poll() on Darwin.
>>
>>I believe this should only apply to Darwin <8.0 or Mac OSX <10.4.0.
>>
>>poll() is known to be broken on the older versions, but it appears to
>>work correctly in 10.4.
> 
> 
> Al Begley @ Apple does not concur:
> 
> http://issues.apache.org/bugzilla/show_bug.cgi?id=34332#c15
> 
> neither does the fact that everywhere I keep reading that poll() is
> "deprecated" on Darwin and is implemented as a wrapper for select() in
> libc.  Or did that change in 10.4?

As far as I know, it changed in 10.4.  The man page no longer mentions
depreciation, and it seems to work correctly.  It would be nice to get
an 'official' word out of someone @apple.com.

>>This could all be mute if we added a KQueue backend for apr_poll().  I
>>had the code to do it at one time, I will look at adding it later this week.
> 
> 
> apr_poll() is not used by apr_wait_for_io_or_timeout().
> 

Yep. It uses poll() directly, or a pollset.  Maybe we should just
preload WAITIO_USES_POLL to 0 on darwin, instead of killing poll completely?

> But making apr_poll() use a kqueue-like interface is a really bad idea
> anyway, as I've argued before.  apr_poll() should be efficient to use
> occasionally or for small numbers of fds; and will be necessarily faster
> than apr_pollset_* in those cases since it requires just one system call
> - no overhead for setting up and tearing down the kqueue/epoll/... 
> interface.

Perhaps, but if they could be cached, and re-used, it is faster if we
will be doing it multiple times.  On FreeBSD, I commonly saw kqueue to
have about 20% lower latency than poll().

-Paul

Re: svn commit: r178386 - /apr/apr/trunk/build/apr_hints.m4

Posted by Joe Orton <jo...@redhat.com>.
On Tue, May 24, 2005 at 11:28:50PM -0700, Paul Querna wrote:
> jorton@apache.org wrote:
> > Author: jorton
> > Date: Tue May 24 23:24:19 2005
> > New Revision: 178386
> > 
> > URL: http://svn.apache.org/viewcvs?rev=178386&view=rev
> > Log:
> > * build/apr_hints.m4 (APR_PRELOAD): Prevent use of poll() on Darwin.
> 
> I believe this should only apply to Darwin <8.0 or Mac OSX <10.4.0.
> 
> poll() is known to be broken on the older versions, but it appears to
> work correctly in 10.4.

Al Begley @ Apple does not concur:

http://issues.apache.org/bugzilla/show_bug.cgi?id=34332#c15

neither does the fact that everywhere I keep reading that poll() is
"deprecated" on Darwin and is implemented as a wrapper for select() in
libc.  Or did that change in 10.4?

> This could all be mute if we added a KQueue backend for apr_poll().  I
> had the code to do it at one time, I will look at adding it later this week.

apr_poll() is not used by apr_wait_for_io_or_timeout().

But making apr_poll() use a kqueue-like interface is a really bad idea
anyway, as I've argued before.  apr_poll() should be efficient to use
occasionally or for small numbers of fds; and will be necessarily faster
than apr_pollset_* in those cases since it requires just one system call
- no overhead for setting up and tearing down the kqueue/epoll/... 
interface.

Regards,

joe


Re: svn commit: r178386 - /apr/apr/trunk/build/apr_hints.m4

Posted by Wilfredo Sánchez Vega <ws...@wsanchez.net>.
   Shouldn't be busy-waiting, as it tries poll() again before write 
().  I'll poke around some more.

     -wsv


On May 25, 2005, at 2:36 PM, Joe Orton wrote:

> The fact that Al is triggering this behaviour so easily leaves me
> entirely unconvinced that this is a happy poll implementation,  
> however.
> Is APR now busy-waiting in the poll/send loop for Al, have you  
> checked a
> system call trace?  Have you run the APR test suite on it, too?
>


Re: svn commit: r178386 - /apr/apr/trunk/build/apr_hints.m4

Posted by Joe Orton <jo...@redhat.com>.
On Tue, May 31, 2005 at 11:25:07AM -0700, Wilfredo Sánchez Vega wrote:
>   I think you're right and that there is some busy-waiting going  
> on.  Though the behavior is legal API-wise, it looks sub-optimal.   
> Given that, disabling poll until there is a kernel without that  
> problem seems prudent.  I'll go ahead and do that later today and do  
> that if no one objects.

Thanks for persevering; prudent is good :)

joe

Re: svn commit: r178386 - /apr/apr/trunk/build/apr_hints.m4

Posted by Wilfredo Sánchez Vega <ws...@wsanchez.net>.
Joe-

   I think you're right and that there is some busy-waiting going  
on.  Though the behavior is legal API-wise, it looks sub-optimal.   
Given that, disabling poll until there is a kernel without that  
problem seems prudent.  I'll go ahead and do that later today and do  
that if no one objects.

     -wsv


On May 25, 2005, at 2:36 PM, Joe Orton wrote:

> On Wed, May 25, 2005 at 11:49:25AM -0700, Wilfredo Sánchez Vega wrote:
>
>>   I just fixed APR to retry on EAGAIN.  We should not disable the
>> use of poll() on Darwin.  It's behavior on 10.4 may be unusual, but
>> it has not been shown to be broken.
>>
>
> It's right for older versions still in any case; please fix it omit  
> 10.4
> if you're really sure that's right, I can't guess a pattern to  
> match the
> appropriate versions.  Your change needs backporting to all the
> branches, too.
>
> The fact that Al is triggering this behaviour so easily leaves me
> entirely unconvinced that this is a happy poll implementation,  
> however.
> Is APR now busy-waiting in the poll/send loop for Al, have you  
> checked a
> system call trace?  Have you run the APR test suite on it, too?
>
> joe


Re: svn commit: r178386 - /apr/apr/trunk/build/apr_hints.m4

Posted by Joe Orton <jo...@redhat.com>.
On Wed, May 25, 2005 at 11:49:25AM -0700, Wilfredo Sánchez Vega wrote:
>   I just fixed APR to retry on EAGAIN.  We should not disable the  
> use of poll() on Darwin.  It's behavior on 10.4 may be unusual, but  
> it has not been shown to be broken.

It's right for older versions still in any case; please fix it omit 10.4
if you're really sure that's right, I can't guess a pattern to match the
appropriate versions.  Your change needs backporting to all the
branches, too.

The fact that Al is triggering this behaviour so easily leaves me
entirely unconvinced that this is a happy poll implementation, however. 
Is APR now busy-waiting in the poll/send loop for Al, have you checked a
system call trace?  Have you run the APR test suite on it, too?

joe

Re: svn commit: r178386 - /apr/apr/trunk/build/apr_hints.m4

Posted by Wilfredo Sánchez Vega <ws...@wsanchez.net>.
   I just fixed APR to retry on EAGAIN.  We should not disable the  
use of poll() on Darwin.  It's behavior on 10.4 may be unusual, but  
it has not been shown to be broken.

   Let's back out this hints change.

     -wsv


On May 24, 2005, at 11:28 PM, Paul Querna wrote:

> jorton@apache.org wrote:
>
>> Author: jorton
>> Date: Tue May 24 23:24:19 2005
>> New Revision: 178386
>>
>> URL: http://svn.apache.org/viewcvs?rev=178386&view=rev
>> Log:
>> * build/apr_hints.m4 (APR_PRELOAD): Prevent use of poll() on Darwin.
>>
>
> I believe this should only apply to Darwin <8.0 or Mac OSX <10.4.0.
>
> poll() is known to be broken on the older versions, but it appears to
> work correctly in 10.4.
>
> This could all be mute if we added a KQueue backend for apr_poll().  I
> had the code to do it at one time, I will look at adding it later  
> this week.
>
> -Paul
>


Re: svn commit: r178386 - /apr/apr/trunk/build/apr_hints.m4

Posted by Paul Querna <ch...@force-elite.com>.
jorton@apache.org wrote:
> Author: jorton
> Date: Tue May 24 23:24:19 2005
> New Revision: 178386
> 
> URL: http://svn.apache.org/viewcvs?rev=178386&view=rev
> Log:
> * build/apr_hints.m4 (APR_PRELOAD): Prevent use of poll() on Darwin.

I believe this should only apply to Darwin <8.0 or Mac OSX <10.4.0.

poll() is known to be broken on the older versions, but it appears to
work correctly in 10.4.

This could all be mute if we added a KQueue backend for apr_poll().  I
had the code to do it at one time, I will look at adding it later this week.

-Paul

Re: svn commit: r178386 - /apr/apr/trunk/build/apr_hints.m4

Posted by Paul Querna <ch...@force-elite.com>.
jorton@apache.org wrote:
> Author: jorton
> Date: Tue May 24 23:24:19 2005
> New Revision: 178386
> 
> URL: http://svn.apache.org/viewcvs?rev=178386&view=rev
> Log:
> * build/apr_hints.m4 (APR_PRELOAD): Prevent use of poll() on Darwin.

I believe this should only apply to Darwin <8.0 or Mac OSX <10.4.0.

poll() is known to be broken on the older versions, but it appears to
work correctly in 10.4.

This could all be mute if we added a KQueue backend for apr_poll().  I
had the code to do it at one time, I will look at adding it later this week.

-Paul