httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christina Fu <fu.christ...@gmail.com>
Subject Re: blocking vs non-blocking apr_bucket_read()
Date Tue, 15 Jan 2008 23:38:11 GMT
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Hi Nick,<br>
<br>
Thanks a lot for the suggestions. What are "streaming bucket types"? <br>
<br>
For the buckets that nonblocking read returns success and zero, I tried
blocking read again and it still returns success and zero length, so I
just pass it to process the next bucket. It seems to work fine. Not
sure why there are zero length heap buckets.<br>
<br>
I have also seen cases where apr_bucket_read() for heap bucket returns
a length larger than 8192, e.g. 8271, and processing of this buffer
caused a segmentation fault due to address out of bound. Any idea why
this could happen? I thought all bucket has a size less than 8192.<br>
<br>
BTW, your apache book has been very helpful to me. Thanks for the good
work!<br>
<br>
Regards,<br>
<br>
Christina<br>
<br>
<br>
<br>
Nick Kew wrote:
<blockquote cite="mid:20080114144025.66e51620@grimnir" type="cite">
  <pre wrap="">On Sat, 12 Jan 2008 19:18:10 -0500
Christina Fu <a class="moz-txt-link-rfc2396E" href="mailto:fu.christina@gmail.com">&lt;fu.christina@gmail.com&gt;</a>
wrote:

  </pre>
  <blockquote type="cite">
    <pre wrap="">Hi,

I am writing a connection level input and output filter. I have 
confusions about whether to use APR_NONBLOCK_READ or APR_BLOCK_READ
when calling apr_bucket_read() function. Could someone advise the
guidelines of using blocking vs non-blocking bucket read?
    </pre>
  </blockquote>
  <pre wrap=""><!---->
There's nothing specific to Apache.  Blocking reads are easier to
work with, but preclude certain forms of optimisation.

  </pre>
  <blockquote type="cite">
    <pre wrap="">I have seen situations when I use APR_NONBLOCK_READ to read a heap

bucket, it returns status of APR_SUCCESS but length is zero.
    </pre>
  </blockquote>
  <pre wrap=""><!---->
Sounds unlikely, unless the bucket had length zero.  It should
only make a difference on streaming bucket types.

  </pre>
  <blockquote type="cite">
    <pre wrap="">   Is this 
case, what shall I do with this bucket? shall I read it again with 
blocking? or pass it and process the next bucket?
    </pre>
  </blockquote>
  <pre wrap=""><!---->
If you've nothing better to do, then yes.  A filter function can
also return to its caller if you don't want blocking.

  </pre>
</blockquote>
</body>
</html>

Mime
View raw message