Re: [mongrel2] [BUG: 2045395ed5] Serving large files on OS X / FreeBSD
- From:
- Alex Gartrell
- Date:
- 2010-12-22 @ 19:32
Good catch! I patched your fix in and the files are coming out
ungarbled (which is obviously awesome).
We're still getting a problem with the following:
[ERROR] (src/dir.c:159: errno: None) Sent other than expected, sent:
-1, but expected: 98666304
But that's obviously pretty minor compared to everything else working,
so I'll update the bug to reflect that.
Thanks again!
Alex
On Wed, Dec 22, 2010 at 11:40 AM, Alex Brasetvik <alex@brasetvik.com> wrote:
> Hi.
>
> When sendfile() is being invoked repeatedly due to EAGAIN-errors, the
offset is not correctly updated.
>
> The result is that the served files are garbled.
>
> >From sendfile(2) on OS X:
>
> When using a socket marked for non-blocking I/O, sendfile() may
send fewer bytes than requested. In this case, the number of bytes
successfully sent is returned in the via the len parameters and the error
EAGAIN is returned.
>
> The man-page for sendfile on FreeBSD is the same, except for a
differently named variable.
>
> I've pushed a simple fix with a regression test to
http://found.no:40080/ --- i.e.
http://found.no:40080/timeline?p=078fc81dcdcdb2ad and its parent commit.
I'm not experienced with this kind of coding, so it could be that it's too
simple.. :)
>
> The tests run on OS X (10.6) and Linux, and I'm able to serve large
files. I don't have any FreeBSD-box, so I haven't tested there.
>
> Bug-link: http://mongrel2.org/info/2045395ed5
> Related bug that didn't really fix the bug:
http://mongrel2.org/tktview?name=e8eddb51a8
>
> --
> Alex Brasetvik
>
>