Return-Path: X-Original-To: apmail-httpd-dev-archive@www.apache.org Delivered-To: apmail-httpd-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id AA00C9835 for ; Fri, 18 Nov 2011 19:52:43 +0000 (UTC) Received: (qmail 61585 invoked by uid 500); 18 Nov 2011 19:52:42 -0000 Delivered-To: apmail-httpd-dev-archive@httpd.apache.org Received: (qmail 61529 invoked by uid 500); 18 Nov 2011 19:52:42 -0000 Mailing-List: contact dev-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list dev@httpd.apache.org Received: (qmail 61521 invoked by uid 99); 18 Nov 2011 19:52:42 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Nov 2011 19:52:42 +0000 X-ASF-Spam-Status: No, hits=0.0 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [98.138.90.68] (HELO nm5.bullet.mail.ne1.yahoo.com) (98.138.90.68) by apache.org (qpsmtpd/0.29) with SMTP; Fri, 18 Nov 2011 19:52:35 +0000 Received: from [98.138.90.54] by nm5.bullet.mail.ne1.yahoo.com with NNFMP; 18 Nov 2011 19:52:14 -0000 Received: from [98.138.84.39] by tm7.bullet.mail.ne1.yahoo.com with NNFMP; 18 Nov 2011 19:52:14 -0000 Received: from [127.0.0.1] by smtp107.mail.ne1.yahoo.com with NNFMP; 18 Nov 2011 19:52:14 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1321645934; bh=lTZx2Fv53pbw7/gDPBtTJ66QogV+WcmaRdEnEWW5E2M=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:Subject:From:To:Content-Type:Date:Message-ID:Mime-Version:X-Mailer:Content-Transfer-Encoding; b=HtSVE4eZ1rW0JA5BQiinJCsYnXHSH3nNZUlvEw3aXTuXojdJYyPdRnavVRuujMN95wPNTzIFB22Kjrrm7we28tRCWhJ+Nb2Tfz9yo81vyHAIOC056MIDEONzBWX+8ei1NtlEJM9vRVOiqfQ9WimYOTXH49UpBvb1cO5C0yvRwHA= X-Yahoo-Newman-Id: 584239.83909.bm@smtp107.mail.ne1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: F_bC19IVM1mpnWe3VYmfnRONTiCZUTjkY7pfMURSjHpqsiP mHvIvokAzPfOmple_KkrVRcT90nFgJpL0lzlrC0ajQUmX2SPJmkW5yhkBkKN yHdNps8Ns1ecqFT94Xb3gValADO6tNv0ii5gVI1z45lAHduLeZM5gzU7QUms 2wtgUN3lBCOA8f5cyRtKrneZ.5IuWVZeMo22ooQIZCFXrFkbi2vpsjzUrrx_ 6l_a30XhApSQSyMFjTx7T7VIEcUlx2fsJJ14G5TcYbnVChBMIa.WrHpuBKfR uUcjDd6vPkBl4rw8fCB1ex0V5VKWnPa3e7xFGxxm0rrPDWUQsOXvm8DjjPDC F5YVfH8uCdq4LYUFeLUgflUzMTglmcBrGPyd_EToq89zrzdy.d5gaZyVNkym FDIP7IoFuQd6lfcpCFH8iLhuERVajEt7Cpe0c7Kh.kg-- X-Yahoo-SMTP: FjJ4d.2swBAbYlkBAr4YgX6afxSF Received: from [192.168.0.111] (f_los_ch@88.134.28.223 with plain) by smtp107.mail.ne1.yahoo.com with SMTP; 18 Nov 2011 11:52:14 -0800 PST Subject: corrupt brigades when using mod_cache in reverse proxy From: f_los_ch To: dev@httpd.apache.org Content-Type: text/plain; charset="UTF-8" Date: Fri, 18 Nov 2011 20:50:23 +0100 Message-ID: <1321645823.3829.100.camel@florian-desktop> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 Content-Transfer-Encoding: 7bit Hi together, I'm messing around with a strange bug now for a few days: When enabling mod_cache in my reverse-proxy scenario, the first file with a filesize above some threshold gets delivered corrupted, subsequent requests served from cache are fine. I noticed it first with some broken images and I'm testing it now with some debug file of ~same size: seq 1 100000 | head -c 113000 When using wget, this file is corrupted at multiple locations (only for the first request), eg. it contains: 1885 1886 1887 2176 2177 2178 After several approaches, I finally added now extensive logging, with dumping all the buckets of the three involved brigades into the log: - in - cache->handle->cache_obj->vobj->bb - cache->out at the places: - beginning of cache_save_filter() - beginning of cache_save_store() - end of cache_save_store() This showed some strange/buggy behavior (or at least I could not understand it) of [i]n, [h]andle, and [o]ut brigades: [...Stripped parts where everything seemed ok to me...] cache_save_filter in: i: [1888, 2175] #note that this are 1440 bytes h: [] o: [] cache_save_store() in: same cache_save_store() out: (consume it, do not flush to out) i: [] h: [1888, 2175] o: [] cache_save_filter in: Boom! i: [2176, 3519], [3776, 3903] #8000 and 640 bytes h: [2176, 2463] #1440 bytes o: [] cache_save_store() in: same [...] As the disk_cache_object_t* vobj passed along to cache_save_filter (-provider) is void* to others, I regard this function as kind of re-entrant, so I assume, no one can intentionally touch vobj->bb as it cannot be dereferenced. So, between the calls of the disk-provider, the 'h'-brigade should remain untouched. That makes sense to me when looking at the code, and other parts of the log showed that behavior. But: when looking at above, the 1440 bytes 1888-2175 from the last run of cache_save_store were replaced by 2176-2463, what is exactly the observed behavior in the delivered file. In addition, there is a missing part between 3519 and 3776 in the input brigade. Any ideas, what could be responsible for that? I could reproduce it even when not loading mod_deflate, mod_proxy_html, mod_substitute, mod_headers et. al. Log & patch available at: http://paste2.org/p/1784183 (~1MB) Where could I debug further? mod_proxy? filters? Any ideas would highly been appreciated. Kind regards, Florian I noticed it already in 2.3.14-beta, and it still persists in 15-beta: $ httpd -V Server version: Apache/2.3.15 (Unix) Server built: Nov 17 2011 17:32:34 Server's Module Magic Number: 20111025:2 Server loaded: APR 1.4.5, APR-UTIL 1.3.12 Compiled using: APR 1.4.5, APR-UTIL 1.3.12 Architecture: 32-bit Server MPM: event threaded: yes (fixed thread count) forked: yes (variable process count) Server compiled with.... -D APR_HAS_SENDFILE -D APR_HAS_MMAP -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled) -D APR_USE_SYSVSEM_SERIALIZE -D APR_USE_PTHREAD_SERIALIZE -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT -D APR_HAS_OTHER_CHILD -D AP_HAVE_RELIABLE_PIPED_LOGS -D DYNAMIC_MODULE_LIMIT=256 -D HTTPD_ROOT="/apache" -D SUEXEC_BIN="/apache/bin/suexec" -D DEFAULT_PIDLOG="logs/httpd.pid" -D DEFAULT_SCOREBOARD="logs/apache_runtime_status" -D DEFAULT_ERRORLOG="logs/error_log" -D AP_TYPES_CONFIG_FILE="conf/mime.types" -D SERVER_CONFIG_FILE="conf/httpd.conf"