From dev-return-18318-apmail-apr-dev-archive=apr.apache.org@apr.apache.org Wed Apr 25 01:06:50 2007 Return-Path: Delivered-To: apmail-apr-dev-archive@www.apache.org Received: (qmail 599 invoked from network); 25 Apr 2007 01:06:49 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 25 Apr 2007 01:06:49 -0000 Received: (qmail 19440 invoked by uid 500); 25 Apr 2007 01:06:53 -0000 Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 19384 invoked by uid 500); 25 Apr 2007 01:06:53 -0000 Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Id: Delivered-To: mailing list dev@apr.apache.org Received: (qmail 19373 invoked by uid 99); 25 Apr 2007 01:06:53 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 24 Apr 2007 18:06:53 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of ryan-apr@trolocsis.com designates 69.94.134.68 as permitted sender) Received: from [69.94.134.68] (HELO zeus.kimaker.com) (69.94.134.68) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 24 Apr 2007 18:06:45 -0700 Received: by zeus.kimaker.com (Postfix, from userid 1002) id 55E51758441; Tue, 24 Apr 2007 18:06:24 -0700 (PDT) Date: Tue, 24 Apr 2007 18:06:24 -0700 From: Ryan Phillips To: dev@apr.apache.org Subject: [PATCH] APR blocking read() Message-ID: <20070425010624.GA46804@zeus.kimaker.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="3MwIy2ne0vdjdPXF" Content-Disposition: inline User-Agent: Mutt/1.5.15 (2007-04-06) X-Virus-Checked: Checked by ClamAV on apache.org --3MwIy2ne0vdjdPXF Content-Type: text/plain; charset=us-ascii Content-Disposition: inline I ran into a problem today with apache blocking on a read. When ap_http_filter was getting called with AP_MODE_EATCRLF and block=APR_NONBLOCKREAD the bucket brigade was blocking (see socket_bucket_read). I am not 100% sure how the bucket brigades are supposed to work on a nonblocking read, but please critique this patch. The patch applies to APR. Backtrace: #0 0x0fd10614 in read () from /lib/libc.so.6 #1 0x0fe86244 in apr_socket_recv (sock=0x10113f20, buf=0x1011c370 "GET / HTTP/1.1\r\nHost: 192.168.0.120\r\nUser-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3\r\nAccept: text/xml,application/xml,application/xhtml+xml,text/html;q="..., len=0x7fc298dc) at network_io/unix/sendrecv.c:81 #2 0x0ff00ba4 in socket_bucket_read (a=0x10118410, str=0x7fc298d8, len=0x7fc298dc, block=Variable "block" is not available. ) at buckets/apr_buckets_socket.c:36 #3 0x44002082 in ?? () #4 0x1002c9cc in ap_core_input_filter (f=0x101144d0, b=0x1011b8b0, mode=Variable "mode" is not available. ) at core_filters.c:188 #5 0x44002024 in ?? () #6 0x1003a00c in ap_get_brigade (next=Variable "next" is not available. ) at util_filter.c:489 #7 0x1003db70 in ap_http_filter (f=0x1011b4f8, b=0x1011b8b0, mode=AP_MODE_EATCRLF, block=APR_NONBLOCK_READ, readbytes=0) at http_filters.c:88 #8 0x1003a00c in ap_get_brigade (next=Variable "next" is not available. ) at util_filter.c:489 #9 0x1003d4b0 in ap_process_request (r=0x1011a390) at http_request.c:212 #10 0x1003a7fc in ap_process_http_connection (c=0x101140b8) at http_core.c:184 #11 0x10036220 in ap_run_process_connection (c=0x101140b8) at connection.c:43 #12 0x10041654 in child_main (child_num_arg=Variable "child_num_arg" is not available. ) at prefork.c:640 #13 0x10041820 in make_child (s=0x10074f90, slot=0) at prefork.c:680 #14 0x100422f4 in ap_mpm_run (_pconf=Variable "_pconf" is not available. ) at prefork.c:956 #15 0x22002022 in ?? () #16 0x10018d64 in main (argc=2, argv=0x7fc29cf4) at main.c:717 --3MwIy2ne0vdjdPXF Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="apr-timeout.patch" Index: sockopt.c =================================================================== --- sockopt.c (revision 532161) +++ sockopt.c (working copy) @@ -102,7 +102,7 @@ /* must disable the incomplete read support if we disable * a timeout */ - if (t <= 0) { + if (t < 0) { sock->options &= ~APR_INCOMPLETE_READ; } sock->timeout = t; --3MwIy2ne0vdjdPXF--