You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Bill Stoddard <st...@raleigh.ibm.com> on 2000/01/24 20:45:14 UTC

sendfile fun

The storage allocated out of sock->cntxt will not be freed until the socket
is freed, which is non deterministic in the general case. Thus, it could
give the appearance of leaking memory on persistent connections.


    /* HP-UX can only send one header iovec and one footer iovec */

    for (i = 0; i < hdtr->numheaders; i++) {
        headerlen += hdtr->headers[i].iov_len;
    }

    headerbuf = ap_palloc(sock->cntxt, headerlen);

    for (i = 0; i < hdtr->numheaders; i++) {
        memcpy(headerbuf, hdtr->headers[i].iov_base + ptr,
               hdtr->headers[i].iov_len);
        ptr += hdtr->headers[i].iov_len;
    }


________________________________________________
Bill Stoddard stoddard@raleigh.ibm.com

Come to the first official Apache Software Foundation
Conference!  <http://ApacheCon.Com/>




Re: sendfile fun

Posted by Manoj Kasichainula <ma...@io.com>.
On Wed, Jan 26, 2000 at 11:06:29AM -0500, Bill Stoddard wrote:
> 
> > On Mon, 24 Jan 2000, Bill Stoddard wrote:
> >
> > > The storage allocated out of sock->cntxt will not be freed until the
> socket
> > > is freed, which is non deterministic in the general case. Thus, it could
> > > give the appearance of leaking memory on persistent connections.
> >
> > Is this really a problem?
> In general, yes. In practice with Apache, I don't think so because Apache
> does not send large headers or trailers. This could change in the future.

And this is easy to fix with a subpool too.


Re: sendfile fun

Posted by Bill Stoddard <st...@raleigh.ibm.com>.
> On Mon, 24 Jan 2000, Bill Stoddard wrote:
>
> > The storage allocated out of sock->cntxt will not be freed until the
socket
> > is freed, which is non deterministic in the general case. Thus, it could
> > give the appearance of leaking memory on persistent connections.
>
> Is this really a problem?
In general, yes. In practice with Apache, I don't think so because Apache
does not send large headers or trailers. This could change in the future. If
we ever start sending 'large' headers or trailers (i.e., something other
than HTTP protocol), then the potential for a problem increases, depending
on how much header/trailer data is sent and the settings of
MaxKeepAliveRequests and KeepAliveTimeout.

Bill


Re: sendfile fun

Posted by rb...@apache.org.
On Mon, 24 Jan 2000, Bill Stoddard wrote:

> The storage allocated out of sock->cntxt will not be freed until the socket
> is freed, which is non deterministic in the general case. Thus, it could
> give the appearance of leaking memory on persistent connections.

Is this really a problem?  Persistent connections still have an enforced
time limit.  Even if the user opens the connection and slowly requests
small amounts of data, that connection will get timed out if we wait long
enough (at least I thought it did).  If it is a persistent connection and
no data is requested, that connection too gets timed out.  I believe those
timeouts are under 5 minutes.  That means that even if it gives the
appearance of a memory leak, that leak isn't actually there, and the
appearance should only remain for the timeout period.

Ryan


Come to the first official Apache Software Foundation
Conference!!!   <http://ApacheCon.Com/>

_______________________________________________________________________________
Ryan Bloom                        	rbb@ntrnet.net
2121 Stonehenge Dr. Apt #3
Raleigh, NC 27615		Ryan Bloom -- thinker, adventurer, artist,
				     writer, but mostly, friend.
-------------------------------------------------------------------------------