<div dir="ltr">Sendfile is now off, using select, and still the same...<br><a href="http://pastebin.com/m2c3ea25b">http://pastebin.com/m2c3ea25b</a><br><br>Yo'av<br><br><div class="gmail_quote">On Sun, Jan 25, 2009 at 7:33 PM, Igor Sysoev <span dir="ltr"><<a href="mailto:is@rambler-co.ru">is@rambler-co.ru</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d">On Sun, Jan 25, 2009 at 06:26:58PM +0200, Yo'av Moshe wrote:<br>
<br>
> Igor, I tried using select instead of poll, but I get the exact same<br>
> problem.<br>
><br>
> Check my strace:<br>
> <a href="http://pastebin.com/m65056ec0" target="_blank">http://pastebin.com/m65056ec0</a><br>
><br>
> I get the same thing with rtsig too.<br>
><br>
> Hints?<br>
> Again, file is at <a href="http://www.noal.org.il/static/temp/hozer.pdf" target="_blank">http://www.noal.org.il/static/temp/hozer.pdf</a>. Server is<br>
> using select now.<br>
<br>
</div>According strace select() does not return event for socket 19 after<br>
sendfile64() sent 1651005 bytes:<br>
<br>
25951 18:14:26 select(20, [7 8 16 19], [19], NULL, {60, 0} <unfinished ...><br>
25951 18:14:27 <... select resumed> ) = 1 (out [19], left {58, 790000})<br>
<br>
25951 18:14:27 gettimeofday({1232900067, 890376}, NULL) = 0<br>
25951 18:14:27 sendfile64(19, 20, [1509465], 440765 <unfinished ...><br>
25951 18:14:27 <... sendfile64 resumed> ) = 141540<br>
25951 18:14:27 sendfile64(19, 20, [1651005], 299225 <unfinished ...><br>
25951 18:14:27 <... sendfile64 resumed> ) = -1 EAGAIN (Resource temporarily unavailable)<br>
<br>
25951 18:14:27 select(20, [16 19], [19], NULL, {0, 500000} <unfinished ...><br>
25951 18:14:28 <... select resumed> ) = 0 (Timeout)<br>
<br>
As you have got the same issue with all methods (even with level triggered<br>
select()), I believe that the bug is in sendfile. You may try to turn<br>
it off even for the single file:<br>
<br>
location = /static/temp/hozer.pdf {<br>
sendfile off;<br>
}<br>
<br>
In Linux 2.6.23 sendfile() has been rewritten to use splice framework.<br>
The bug may be introduced while rewriting.<br>
<br>
BTW, it seems that thttpd does not use sendfile.<br>
<div><div></div><div class="Wj3C7c"><br>
> Thanks...<br>
> Yo'av.<br>
><br>
> On Fri, Jan 23, 2009 at 3:05 PM, Igor Sysoev <<a href="mailto:is@rambler-co.ru">is@rambler-co.ru</a>> wrote:<br>
><br>
> > On Fri, Jan 23, 2009 at 02:35:00PM +0200, Yo'av Moshe wrote:<br>
> ><br>
> > > Thanks Igor.<br>
> > > I don't want to be rude, but I find it hard to believe that it's a kernel<br>
> > > bug.<br>
> > ><br>
> > > First, I'm using the default CentOS 5.2 kernel, it's seems to me pretty<br>
> > odd<br>
> > > that there's such a bug in it. CentOS is being used on a lot of servers,<br>
> > > some of them must be running nginx.<br>
> > ><br>
> > > Second, I tried serving the same file with thttpd, and it runs just fine.<br>
> > > <a href="http://195.28.180.147:40/temp/hozer.pdf" target="_blank">http://195.28.180.147:40/temp/hozer.pdf</a><br>
> > > Note it's the exact same file which I cannot get from nginx:<br>
> > > <a href="http://www.noal.org.il/static/temp/hozer.pdf" target="_blank">http://www.noal.org.il/static/temp/hozer.pdf</a><br>
> > ><br>
> > > How come thttpd can serve the file just fine? If it's a kernel bug, I<br>
> > > thought it would happen with all of my servers.<br>
> > > If it's using some different way of sending the files which does not<br>
> > depend<br>
> > > on that epoll call - is there any way to configure nginx to use that as<br>
> > > well?<br>
> ><br>
> > I do not look modern thttpd, but according its change log, it has no<br>
> > epoll support. You may try different ways in nginx: you need to build it<br>
> ><br>
> > --with-rtsig_module<br>
> > --with-select_module<br>
> > --with-poll_module<br>
> ><br>
> > and then choose method:<br>
> ><br>
> > events {<br>
> > use select;<br>
> > #use poll;<br>
> > #use rtsig;<br>
> > }<br>
> ><br>
> > Also, epoll has two modes: level triggered (default) and edge<br>
> > triggered (EPOLLET). nginx uses more effective edge triggered mode,<br>
> > lighttpd uses level triggered one. The bug may be in ET mode only.<br>
> ><br>
> > As to probabilty of kernel bugs: I saw them in FreeBSD (kqueue, sendfile),<br>
> > Linux (epoll), Solaris (event ports), and MacOSX (kqueue, sendfile).<br>
> ><br>
> > > Can I do anything to confirm that it's a kernel bug? If it is, I should<br>
> > > probably contact CentOS's maintainers.<br>
> ><br>
> > Your straces confirms this: nginx added socket to epoll and did not<br>
> > deleted it, nevertheless epoll does not send event.<br>
> ><br>
> > > Thank you, again.<br>
> > > Yo'av.<br>
> > ><br>
> > > On Wed, Jan 21, 2009 at 7:26 AM, Igor Sysoev <<a href="mailto:is@rambler-co.ru">is@rambler-co.ru</a>> wrote:<br>
> > ><br>
> > > > On Wed, Jan 21, 2009 at 01:52:53AM +0200, Yo'av Moshe wrote:<br>
> > > ><br>
> > > > > Igor, here's the new strace.<br>
> > > > > <a href="http://pastebin.com/m5129c54b" target="_blank">http://pastebin.com/m5129c54b</a><br>
> > > > ><br>
> > > > > Does the fact it works in low download rates still makes you think<br>
> > it's a<br>
> > > > > kernel issue?<br>
> > > ><br>
> > > > Yes, this is seems like a kernel issue. Kernel excatly said (with<br>
> > EAGAIN)<br>
> > > > that there is no place to output data, but never returned a new<br>
> > > > notification<br>
> > > > via epoll_wait() about free space:<br>
> > > ><br>
> > > > 21420 01:39:43 <... epoll_wait resumed> {{EPOLLOUT, {u32=153137960,<br>
> > > > u64=13811628390360331048}}}, 512, 60000) = 1<br>
> > > > 21420 01:39:43 gettimeofday({1232494783, 413764}, NULL) = 0<br>
> > > > 21420 01:39:43 sendfile64(20, 21, [1645625], 304605) = 40320<br>
> > > > 21420 01:39:43 sendfile64(20, 21, [1685945], 264285) = -1 EAGAIN<br>
> > (Resource<br>
> > > > temporarily unavailable)<br>
> > > > 21420 01:39:43 epoll_wait(11, <unfinished ...><br>
> > > ><br>
> > > > This is probably some race condition inside kernel, that does not<br>
> > appear on<br>
> > > > low speed download.<br>
> > > ><br>
> > > > > Thank you, really!<br>
> > > > > And thanks, Kiril and Jeff, for confirming that!<br>
> > > > ><br>
> > > > > Yo'av.<br>
> > > > ><br>
> > > > ><br>
> > > > > On Tue, Jan 20, 2009 at 9:39 PM, Kiril Angov <<a href="mailto:kupokomapa@gmail.com">kupokomapa@gmail.com</a>><br>
> > > > wrote:<br>
> > > > ><br>
> > > > > > wget <a href="http://www.noal.org.il/static/temp/barvazi2.pdf" target="_blank">http://www.noal.org.il/static/temp/barvazi2.pdf</a><br>
> > > > > > --2009-01-20 21:36:00--<br>
> > > > <a href="http://www.noal.org.il/static/temp/barvazi2.pdf" target="_blank">http://www.noal.org.il/static/temp/barvazi2.pdf</a><br>
> > > > > > Resolving www.noal.org.il... 195.28.180.147<br>
> > > > > > Connecting to <a href="http://www.noal.org.il" target="_blank">www.noal.org.il</a>|195.28.180.147|:80... connected.<br>
> > > > > > HTTP request sent, awaiting response... 200 OK<br>
> > > > > > Length: 1950230 (1.9M) [application/pdf]<br>
> > > > > > Saving to: `barvazi2.pdf'<br>
> > > > > ><br>
> > > > > > 81% [=====================================> ] 1,596,665<br>
> > > > > > --.-K/s eta 5s<br>
> > > > > ><br>
> > > > > ><br>
> > > > > > wget -c <a href="http://www.noal.org.il/static/temp/barvazi2.pdf" target="_blank">http://www.noal.org.il/static/temp/barvazi2.pdf</a><br>
> > > > > > --2009-01-20 21:38:28--<br>
> > > > > > <a href="http://www.noal.org.il/static/temp/barvazi2.pdf" target="_blank">http://www.noal.org.il/static/temp/barvazi2.pdf</a><br>
> > > > > > Resolving www.noal.org.il... 195.28.180.147<br>
> > > > > > Connecting to <a href="http://www.noal.org.il" target="_blank">www.noal.org.il</a>|195.28.180.147|:80... connected.<br>
> > > > > > HTTP request sent, awaiting response... 206 Partial Content<br>
> > > > > > Length: 1950230 (1.9M), 305960 (299K) remaining [application/pdf]<br>
> > > > > > Saving to: `barvazi2.pdf'<br>
> > > > > ><br>
> > > > > > 100%[+++++++++++++++++++++++++++++++++++++++=======>] 1,950,230<br>
> > > > > > 295K/s in 1.0s<br>
> > > > > ><br>
> > > > > > 2009-01-20 21:38:30 (295 KB/s) - `barvazi2.pdf' saved<br>
> > [1950230/1950230]<br>
> > > > > ><br>
> > > > > ><br>
> > > > > > On Tue, Jan 20, 2009 at 9:31 PM, jeff emminger <<br>
> > <a href="mailto:jemminger@gmail.com">jemminger@gmail.com</a>><br>
> > > > > > wrote:<br>
> > > > > > >> Could anyone confirm that this works:<br>
> > > > > > >> wget --limit-rate=3500<br>
> > > > <a href="http://www.noal.org.il/static/temp/barvazi2.pdf" target="_blank">http://www.noal.org.il/static/temp/barvazi2.pdf</a><br>
> > > > > > >> while this doesn't:<br>
> > > > > > >> wget <a href="http://www.noal.org.il/static/temp/barvazi2.pdf" target="_blank">http://www.noal.org.il/static/temp/barvazi2.pdf</a><br>
> > > > > > >><br>
> > > > > > ><br>
> > > > > > > Confirmed<br>
> > > > > > ><br>
> > > > > > ><br>
> > > > > ><br>
> > > > > ><br>
> > > > ><br>
> > > > ><br>
> > > > > --<br>
> > > > > Yo'av Moshe<br>
> > > ><br>
> > > > --<br>
> > > > Igor Sysoev<br>
> > > > <a href="http://sysoev.ru/en/" target="_blank">http://sysoev.ru/en/</a><br>
> > > ><br>
> > > ><br>
> > ><br>
> > ><br>
> > > --<br>
> > > Yo'av Moshe<br>
> ><br>
> > --<br>
> > Igor Sysoev<br>
> > <a href="http://sysoev.ru/en/" target="_blank">http://sysoev.ru/en/</a><br>
> ><br>
> ><br>
><br>
><br>
> --<br>
> Yo'av Moshe<br>
<br>
</div></div>--<br>
<div><div></div><div class="Wj3C7c">Igor Sysoev<br>
<a href="http://sysoev.ru/en/" target="_blank">http://sysoev.ru/en/</a><br>
<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Yo'av Moshe<br>
</div>