Re: Re: Non Blocking write in apache

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Yann,

Thanks for your explanation. I got  the issue.
Actually NonStop has maximum limit of 52KB only for writev. Therefore I was getting 4022 after 49KB. Because after 49KB, apache is adding 8K more bytes which leads to 56KB. Therefore, writev was failing.

To solve this, I have changed  THRESHOLD_MAX_BUFFER in core_filter.c to 50000. But again I am seeing that after 49KB, apache is adding 8192 Bytes in it, which leads to failure of writev again.

Do I need to change in more places or the above fix should work.
Thanks
Hemant

On Sun, Sep 16, 2018 at 4:48 PM Yann Ylavic <ylavic.dev@xxxxxxxxx> wrote:
Hi Hermant,

On Fri, Sep 14, 2018 at 1:53 PM Hemant Chaudhary
<hemantdude.chaudhary@xxxxxxxxx> wrote:
>
> Please don't get confuse with Cygwin(Windows). I am running apache on NonStop(Tandem).

Well, isn't the error_log attached to the previous message relevant
(be it cygwin or not)?
Btw, LogLevel trace6 would help here.

> I have put breakpoint at apr_poll() but it is not going there.
>
> Few Events of writing :
> 1) apache writes 779 bytes to tomcat from apr_socket_sendv() function and writev functions returns success.
> 2) apache writes 24604 bytes to tomcat from apr_socket_sendv() function but writev function returns -1 with EWOULDBLOCK and it has timeout=0(because set in writev_nonblocking())
> 3) apache again tries to write 32796 to tomcat from apr_socket_sendv() function but writev function returns -1 with EWOULDBLOCK and it has timeout=0(because set in writev_nonblocking()).
> 4) apache again tries to write 40988 to tomcat from apr_socket_sendv() function but writev function returns -1 with EWOULDBLOCK and it has timeout=0(because set in writev_nonblocking()).
> 5) apache again tries to write 49180 to tomcat from apr_socket_sendv() function but writev function returns -1 with EWOULDBLOCK and it has timeout=0(because set in writev_nonblocking()).

OK, all those EWOULDBLOCK make the core output filter to bufferize the
"pending" data for the next time it's called.

> 6) After this I am getting 4022 error.

Here the 64K bufferized limit/threshold is reached
(non_file_bytes_in_brigade >= THRESHOLD_MAX_BUFFER in
ap_core_output_filter()), so the core output filter can't continue
nonblocking anymore and enters send_brigade_blocking(), which does
send_brigade_nonblocking() + apr_poll() until the 64K buffer is sent
completely.

However it seems that on your system the first call to
send_brigade_nonblocking() fails (since apr_poll() is never called),
possibly a limit on apr_socket_sendv() (i.e. writev() syscall), either
more than 64K total bytes or nvec > 4?

I think you need to debug/gdb in send_brigade_nonblocking() for this
last call and determine where and why send_brigade_nonblocking() =>
writev_nonblocking() => apr_socket_send() => writev(vec, nvec) fails.
Maybe a unit test (a simple standalone main() program) can determine
the limits for writev() on your system, so that the right values for
THRESHOLD_MAX_BUFFER and MAX_IOVEC_TO_WRITE (in
"server/core_filters.c") can be tuned for NonStop(Tandem) ...

Hope that helps,
Yann.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux