On 7/10/23 10:11 AM, Joe Orton wrote:
> On Fri, Jul 07, 2023 at 03:52:46PM -0000, yla...@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