httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Juan Rivera <Juan.Riv...@citrix.com>
Subject RE: EOS or FLUSH buckets
Date Mon, 09 Jun 2003 22:05:48 GMT
Here is why I'm asking. I wrote a SOCKS proxy module. It has two connection
records, one for the client and one for the backend server.

When I received data I pass it to the other side with a flush at the end. It
works fine with one problem. The core output filter splits the brigade after
the flush bucket creating a new bucket brigade. This bucket brigade is never
destroyed, consuming 16 bytes of memory (apr_brigade.c: line 84). This may
not be a problem for short lived connection but it the connection is long
lived the pool keeps getting bigger and bigger. Is there any way around
this?

So I though, I should use an EOS bucket instead (maybe not a good idea) but
I found that the core output filter was setting aside my buckets. This
section in core.c looks bogus to me:

Core.c line 3884:

        if (nbytes + flen < AP_MIN_BYTES_TO_WRITE
            && ((!fd && !more && !APR_BUCKET_IS_FLUSH(last_e))
                || (APR_BUCKET_IS_EOS(last_e)
                    && c->keepalive == AP_CONN_KEEPALIVE))) {
		/* set aside the buckets */
		}

	What is weird about this code is that if the last bucket in the
bridade is an EOS, this part: ((!fd && !more &&
!APR_BUCKET_IS_FLUSH(last_e)) will return true as long as you are not
serving a file.

	But it seems that you want that to happen only if the connection is
a keep-alive connection. Right?

Any suggestions how to deal with this?

Juan


-----Original Message-----
From: William A. Rowe, Jr. [mailto:wrowe@rowe-clan.net] 
Sent: Monday, June 09, 2003 5:42 PM
To: dev@httpd.apache.org
Cc: 'dev@httpd.apache.org'
Subject: Re: EOS or FLUSH buckets

At 04:29 PM 6/9/2003, Juan Rivera wrote:

>When should one use an EOS bucket vs. a FLUSH bucket?

At EOS, that's all she wrote; body or connection finished, nothing
more, don't call me, and I won't call you.

So a flush bucket is a request; please get rid of any lingering data
and push it on to the client.

I meant it's a request, consider a filter that does codepage translation,
and we have half of a multibyte character sequence.  There is no way
to flush that half a character because we don't know what it will become.

So flush should be respected as far as possible, but you cannot trust
that everything is flushed.  At EOS, such an incomplete translation
would have to be performed (or discarded) because there is nothing
more to come.

Bill


Mime
View raw message