Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Dec 2001 14:40:02 -0800 (PST)
From:      Justin Erenkrantz <justin@erenkrantz.com>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: kern/32684: sendfile(2) with threads (libc_r) does not work in non-blocking mode
Message-ID:  <200112102240.fBAMe2E51395@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/32684; it has been noted by GNATS.

From: Justin Erenkrantz <justin@erenkrantz.com>
To: freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: kern/32684: sendfile(2) with threads (libc_r) does not work in non-blocking mode
Date: Mon, 10 Dec 2001 14:30:47 -0800

 Err, cut-and-paste didn't work for how-to-repeat.  *sigh*  Should
 have sent an email instead of using the webform...  Sorry.  This
 should be better.
 ---------------
 We have a reproducable test case in our APR (Apache Portability=20
 Runtime) library.  If time permits, I will try to de-APRize this=20
 test case and post an addendum with a URL to the testfile. =20
 
 1) Apache 2.0 is based off of APR.  You can grab the latest CVS
 copy of APR from:
 :pserver:anoncvs@cvs.apache.org:/home/cvspublic
 (anoncvs password is "anoncvs")
 cvs co apr
 2) Run ./buildconf to generate all of the build stuff (we require
 libtool and autoconf...)
 3) Run ./configure with --enable-threads to override our disabling
 of FreeBSD thread support.  (You may want to add --disable-shared.)
 4) make all (duh)
 5) If you want some extra help from the sendfile test program, go to:
 http://www.apache.org/~jerenkrantz/freebsd/sendfile.patch and apply it.
 It's a slightly modified version of the one in the
 repository to give more output.  It also allows for remote
 connection of the sendfile test suite.  I'm not too comfortable
 committing it just yet, so the web site will have to do.  =3D)
 6) make sendfile in test/ dir.
 7) Okay, our test program needs a client and server.  So:
 =2E/sendfile server
 =2E/sendfile client {blocking|nonblocking|timeout}
 If you apply the patch, this version also allows for:
 =2E/sendfile client nonblocking 192.168.0.2
 to have the client connect to a remote server - that may or may
 not be of help.  It is for me, so it's there.  =3D)  Otherwise,
 the server and client must be on the same machine.
 FWIW, I run the server like so:
 while true; do ./sendfile server; done
 (Timeout is essentially equivalent to non-blocking but places an
 upper limit on how long we will wait.  I wouldn't worry about
 timeout that much - if non-blocking works, it should work as well.)
 8) We send the data with the following segments:
 - 15 byte header (1234567890ABCD)
 - 5 byte header (EFGH)
 - 80,000 byte header (only ^)
 - A 200,000 byte file containing only 0s.  (this is the file.)
 - 19 byte trailer (IJKLMNOPQRSTUVWXYZ)
 - 10 byte trailer (!@#$%&*()\n)
 - 90,000 byte trailer (only @)
 9) APR's actual sendfile() call is located in
    network_io/unix/sendrecv.c.
    Look for __FreeBSD__.
 10) It works with blocking mode in all cases.  Non-blocking mode only
 work with threads disabled (--disable-threads).
 11) With the patch, we definitely made some progress as we are
 getting past the headers and are sending the file.  However,
 I will attempt to track this down time permitting, but since you
 know FreeBSD much better than I do, I think you guys have better
 luck.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200112102240.fBAMe2E51395>