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

Jens Páll jens@REDACTED
Tue Sep 8 23:09:19 CEST 2015


 

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 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20150908/e334784f/attachment.htm>


More information about the erlang-bugs mailing list