You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Joe Orton <jo...@redhat.com> on 2023/07/10 08:11:02 UTC
Re: svn commit: r1910861 - /httpd/httpd/trunk/support/ab.c
On Fri, Jul 07, 2023 at 03:52:46PM -0000, ylavic@apache.org wrote:
> Author: ylavic
> Date: Fri Jul 7 15:52:45 2023
> New Revision: 1910861
>
> URL: http://svn.apache.org/viewvc?rev=1910861&view=rev
> Log:
> ab: Fix accounting of started connections.
>
> Revert when a kept alive connection is aborted on read.
> Stop the polling loop when there is nothing to poll anymore, it's simpler.
Not related to this change but I noticed that trunk ab has stopped
failing if trying to connect to a closed port, strace looks like:
epoll_wait(3, [{events=EPOLLOUT|EPOLLERR|EPOLLHUP, data={u32=33073216, u64=33073216}}], 2, 30000) = 1
epoll_wait(3, [{events=EPOLLOUT|EPOLLERR|EPOLLHUP, data={u32=33073216, u64=33073216}}], 2, 30000) = 1
...
With HUP set in the returned events it enters the first if() at
https://github.com/apache/httpd/blob/trunk/support/ab.c#L2523 but
STATE_CONNECTING is not handled there and so it loops indefinitely.
That's as far as I debugged it, sorry. Any ideas?
Re: svn commit: r1910861 - /httpd/httpd/trunk/support/ab.c
Posted by Joe Orton <jo...@redhat.com>.
On Mon, Jul 10, 2023 at 11:12:09AM +0200, Yann Ylavic wrote:
> I think this is not reached with rtnevents == POLLOUT|POLLHUP because
> it takes the first POLLIN|POLLHUP continue-branch.
> I moved the check for POLLOUT first in r1910911, which fixed the issue for me.
Perfect, works for me too - thanks Yann.
Regards, Joe
Re: svn commit: r1910861 - /httpd/httpd/trunk/support/ab.c
Posted by Yann Ylavic <yl...@gmail.com>.
On Mon, Jul 10, 2023 at 10:53 AM Ruediger Pluem <rp...@apache.org> wrote:
>
> On 7/10/23 10:11 AM, Joe Orton wrote:
> > On Fri, Jul 07, 2023 at 03:52:46PM -0000, ylavic@apache.org wrote:
> >> Author: ylavic
> >> Date: Fri Jul 7 15:52:45 2023
> >> New Revision: 1910861
> >>
> >> URL: http://svn.apache.org/viewvc?rev=1910861&view=rev
> >> Log:
> >> ab: Fix accounting of started connections.
> >>
> >> Revert when a kept alive connection is aborted on read.
> >> Stop the polling loop when there is nothing to poll anymore, it's simpler.
> >
> > Not related to this change but I noticed that trunk ab has stopped
> > failing if trying to connect to a closed port, strace looks like:
> >
> > epoll_wait(3, [{events=EPOLLOUT|EPOLLERR|EPOLLHUP, data={u32=33073216, u64=33073216}}], 2, 30000) = 1
> > epoll_wait(3, [{events=EPOLLOUT|EPOLLERR|EPOLLHUP, data={u32=33073216, u64=33073216}}], 2, 30000) = 1
> > ...
> >
> > With HUP set in the returned events it enters the first if() at
> > https://github.com/apache/httpd/blob/trunk/support/ab.c#L2523 but
> > STATE_CONNECTING is not handled there and so it loops indefinitely.
> > That's as far as I debugged it, sorry. Any ideas?
>
> I would guess that the below fixes the loop, but I am not sure if it is the correct fix.
>
> Index: support/ab.c
> ===================================================================
> --- support/ab.c (revision 1910910)
> +++ support/ab.c (working copy)
> @@ -2534,6 +2534,11 @@
> case STATE_READ:
> read_response(c);
> break;
> + case STATE_CONNECTING:
> + if (rtnew & APR_POLLHUP) {
> + try_reconnect(c, APR_ENOPOLL);
> + }
> + break;
> }
>
> continue;
I think this is not reached with rtnevents == POLLOUT|POLLHUP because
it takes the first POLLIN|POLLHUP continue-branch.
I moved the check for POLLOUT first in r1910911, which fixed the issue for me.
Regards;
Yann.
Re: svn commit: r1910861 - /httpd/httpd/trunk/support/ab.c
Posted by Ruediger Pluem <rp...@apache.org>.
On 7/10/23 10:11 AM, Joe Orton wrote:
> On Fri, Jul 07, 2023 at 03:52:46PM -0000, ylavic@apache.org wrote:
>> Author: ylavic
>> Date: Fri Jul 7 15:52:45 2023
>> New Revision: 1910861
>>
>> URL: http://svn.apache.org/viewvc?rev=1910861&view=rev
>> Log:
>> ab: Fix accounting of started connections.
>>
>> Revert when a kept alive connection is aborted on read.
>> Stop the polling loop when there is nothing to poll anymore, it's simpler.
>
> Not related to this change but I noticed that trunk ab has stopped
> failing if trying to connect to a closed port, strace looks like:
>
> epoll_wait(3, [{events=EPOLLOUT|EPOLLERR|EPOLLHUP, data={u32=33073216, u64=33073216}}], 2, 30000) = 1
> epoll_wait(3, [{events=EPOLLOUT|EPOLLERR|EPOLLHUP, data={u32=33073216, u64=33073216}}], 2, 30000) = 1
> ...
>
> With HUP set in the returned events it enters the first if() at
> https://github.com/apache/httpd/blob/trunk/support/ab.c#L2523 but
> STATE_CONNECTING is not handled there and so it loops indefinitely.
> That's as far as I debugged it, sorry. Any ideas?
I would guess that the below fixes the loop, but I am not sure if it is the correct fix.
Index: support/ab.c
===================================================================
--- support/ab.c (revision 1910910)
+++ support/ab.c (working copy)
@@ -2534,6 +2534,11 @@
case STATE_READ:
read_response(c);
break;
+ case STATE_CONNECTING:
+ if (rtnew & APR_POLLHUP) {
+ try_reconnect(c, APR_ENOPOLL);
+ }
+ break;
}
continue;
Regards
Rüdiger