Return-Path: Delivered-To: apmail-httpd-apreq-dev-archive@www.apache.org Received: (qmail 18253 invoked from network); 14 Sep 2006 21:27:09 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 14 Sep 2006 21:27:08 -0000 Received: (qmail 58012 invoked by uid 500); 14 Sep 2006 21:27:06 -0000 Delivered-To: apmail-httpd-apreq-dev-archive@httpd.apache.org Received: (qmail 57970 invoked by uid 500); 14 Sep 2006 21:27:05 -0000 Mailing-List: contact apreq-dev-help@httpd.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Id: Delivered-To: mailing list apreq-dev@httpd.apache.org Received: (qmail 57856 invoked by uid 99); 14 Sep 2006 21:27:05 -0000 Received: from idunn.apache.osuosl.org (HELO idunn.apache.osuosl.org) (140.211.166.84) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Sep 2006 14:27:05 -0700 X-ASF-Spam-Status: No, hits=0.1 required=5.0 tests=FORGED_RCVD_HELO Received: from ([81.103.221.48:35547] helo=mtaout02-winn.ispmail.ntl.com) by idunn.apache.osuosl.org (ecelerity 2.1 r(10620)) with ESMTP id C2/50-07618-AD8C9054 for ; Thu, 14 Sep 2006 14:27:01 -0700 Received: from aamtaout04-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout02-winn.ispmail.ntl.com with ESMTP id <20060914212543.YXGF27023.mtaout02-winn.ispmail.ntl.com@aamtaout04-winn.ispmail.ntl.com> for ; Thu, 14 Sep 2006 22:25:43 +0100 Received: from [127.0.0.1] (really [82.21.102.213]) by aamtaout04-winn.ispmail.ntl.com with ESMTP id <20060914212543.TOYK15733.aamtaout04-winn.ispmail.ntl.com@[127.0.0.1]> for ; Thu, 14 Sep 2006 22:25:43 +0100 Message-ID: <4509C8D3.40505@marste.net> Date: Thu, 14 Sep 2006 22:25:39 +0100 From: Olly Stephens User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: apreq-dev@httpd.apache.org Subject: upload hangs when file is multiple of 64K size References: <1158268588.40139.ezmlm@httpd.apache.org> In-Reply-To: <1158268588.40139.ezmlm@httpd.apache.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hi, I discovered this bug in a huge chunk of code that deals with huge uploads and it took me *ages* to work out what was causing it. But once I had, I whittled it down to a small testcase. Any upload whose size is an exact multiple of 64K (which appears to be the block size used by the filter code) will hang during the parse, eventually timing out. I'm using apreq2-2.08 with httpd-2.2.3 on solaris 10. It's a 64-bit build. The code that I use to reproduce this (just to make sure I'm not doing something wrong) is: static int apreqbug_handler(request_rec *r) { apreq_handle_t *apreq ; const apr_table_t *paramt ; const apreq_param_t *param ; apr_status_t status ; apr_size_t size ; char buf[256] ; if (strcmp(r->handler, "apreqbug")) { return DECLINED ; } r->content_type = "text/html"; if (r->method_number != M_POST) { ap_rputs("Not a POST request\n", r) ; return OK ; } apreq = apreq_handle_apache2(r) ; status = apreq_body(apreq, ¶mt) ; if (status != APR_SUCCESS) { ap_rputs("Failed to get apreq params\n", r) ; return OK ; } param = apreq_upload(paramt, "upload"); if (param == NULL) { ap_rputs("No upload parameter provided\n", r) ; return OK ; } status = apr_brigade_length(param->upload, 0, &size) ; if (status != APR_SUCCESS) { ap_rputs("Failed to get length of upload\n", r) ; return OK ; } sprintf(buf, "upload size is %ld\n", size) ; ap_rputs(buf, r) ; return OK ; } I'm using curl to upload test files to it. Uploading a 65535 byte file, or a 65537 byte file works fine; uploading a 65536 byte file (or any exact multiple) hangs in the apreq_body() call and finally fails with a brigade timeout error. Am I doing something wrong in my code? If not, can anyone else reproduce this problem? (if so, is it a solaris-specific issue?) Finally, any hints on how to go about debugging it would be most welcome. Thanks in advance, Olly