[erlang-bugs] file:sendfile broken on FreeBSD?

Loïc Hoguin essen@REDACTED
Wed Sep 9 10:25:33 CEST 2015


For reference: 
https://github.com/ninenines/cowboy/issues/889#issuecomment-138704428

Says OTP 18.

On 09/09/2015 09:33 AM, Lukas Larsson wrote:
> Hello Jens,
>
> Thanks for the bug report.
>
> I cannot find any information about which versions of Erlang/OTP you
> have tried this on.
>
> Lukas
>
> On Tue, Sep 8, 2015 at 11:09 PM, Jens Páll <jens@REDACTED
> <mailto:jens@REDACTED>> wrote:
>
>     __
>
>     Hi
>
>     I've been doing some tests using file:sendfile on FreeBSD 10 and it
>     seems to be broken. It's unable to send files that are larger than
>     the OS send buffer.
>
>     For example, if the buffer is 32KB, then only 48.996 bytes are sent
>     to the client but from time to time it sends 130.708 bytes. It's
>     always those numbers of bytes sent, 48.996 being the more popular one.
>
>     I discovered this when using Cowboy. I contacted Luic and we have
>     been discussing some options, like the server could be closing the
>     socket too soon. I created a simple test server to try things out
>     where I for example delayed the closing of the socket well beyond
>     the time it took the client to receive a full buffer. It had no
>     effect, that is, the client just received its one and a half buffer
>     and then waited until the server got to closing the socket. I tried
>     both versions of sendfile.
>
>     If I use gen_tcp:send instead, the data is sent without any problems
>     so I know the server works correctly.
>
>     Luic is planning on testing this in a few days but since I'm pretty
>     sure (I can't rule out the possibility that I could be doing
>     something wrong) the problem lies with Erlang itself I decided to
>     post this here to get some further feedback.
>
>     I have a test server and client on github if someone cares to take a
>     look: https://github.com/theom/eclm
>
>     Thanks,
>
>     Jens Páll
>
>
>     _______________________________________________
>     erlang-bugs mailing list
>     erlang-bugs@REDACTED <mailto:erlang-bugs@REDACTED>
>     http://erlang.org/mailman/listinfo/erlang-bugs
>
>
>
>
> _______________________________________________
> erlang-bugs mailing list
> erlang-bugs@REDACTED
> http://erlang.org/mailman/listinfo/erlang-bugs
>

-- 
Loïc Hoguin
http://ninenines.eu
Author of The Erlanger Playbook,
A book about software development using Erlang



More information about the erlang-bugs mailing list