Return-Path: X-Original-To: apmail-apr-dev-archive@www.apache.org Delivered-To: apmail-apr-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 0F436178E1 for ; Wed, 23 Sep 2015 19:48:56 +0000 (UTC) Received: (qmail 45750 invoked by uid 500); 23 Sep 2015 19:48:49 -0000 Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 45671 invoked by uid 500); 23 Sep 2015 19:48:49 -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 45661 invoked by uid 99); 23 Sep 2015 19:48:49 -0000 Received: from Unknown (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 23 Sep 2015 19:48:49 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 0FD1FF76C8 for ; Wed, 23 Sep 2015 19:48:49 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.653 X-Spam-Level: X-Spam-Status: No, score=0.653 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, SPF_NEUTRAL=0.652, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=comcast.net Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id n81nZDVSdcLC for ; Wed, 23 Sep 2015 19:48:39 +0000 (UTC) Received: from resqmta-ch2-04v.sys.comcast.net (resqmta-ch2-04v.sys.comcast.net [69.252.207.36]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with ESMTPS id 1E6C920512 for ; Wed, 23 Sep 2015 19:48:38 +0000 (UTC) Received: from resomta-ch2-17v.sys.comcast.net ([69.252.207.113]) by resqmta-ch2-04v.sys.comcast.net with comcast id Ljn31r0082TL4Rh01joYrK; Wed, 23 Sep 2015 19:48:32 +0000 Received: from [192.168.199.10] ([69.251.84.114]) by resomta-ch2-17v.sys.comcast.net with comcast id LjoX1r0052U0RYt01joXEK; Wed, 23 Sep 2015 19:48:32 +0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) Subject: Re: Issues/questions with apr_memcache_multigetp From: Jim Jagielski In-Reply-To: Date: Wed, 23 Sep 2015 15:48:30 -0400 Cc: dev@apr.apache.org Content-Transfer-Encoding: quoted-printable Message-Id: References: To: Jeffrey Crowell X-Mailer: Apple Mail (2.2104) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20140121; t=1443037712; bh=VWh+XrmwG2oYbnuYP+N0Ibl/lIvBS0qaVW4FhQPQLGs=; h=Received:Received:Content-Type:Mime-Version:Subject:From:Date: Message-Id:To; b=MsPxs4tGZe2yQlffx5MAWj8MbDaFgYeFmbK5sEwQ66ZVT2kA30ze91c6p4HnTpNPA ZIloIK/4OkyjsmvyjI3097KZSj/4H7enNLyWxOAN7CI6CrXMWe1hiJhKGX9izbb1F1 27E19oOEaA0hy+GjRthHkq1vqbfc/cFV8XjJ4fpZQXnTtevtIfnd1Am895J4hqOQnu Dgo2EKHqe696W/Ns0UO7jTj/RWv/OJfIC4WvjwG6+DdY5pMmK30e6AeEqddlEKs0dj gjE6db348J1gSBLgECoTsJx0Opxn3SvtiUeokB7XXbEqTmsQlswhyqASbq4rdGFdpA 164pguhjE8vEQ== Haven't looked at the actual bug but yet, in general, we appreciate it when people send in patches that fix bugs or errors in our code instead of simply forking off those changes. Apache tries to work a little bit differently than the current buzz about forking and working in isolation; we instead encourage people to collaborate w/ the actual project itself, submitting bug reports and patches, and working as a cohesive group, rather than scattered islands of code :) Thx! > On Sep 23, 2015, at 3:23 PM, Jeffrey Crowell = wrote: >=20 > Hi, >=20 > I work on mod_pagespeed, where we use a forked version of = apr_memcache.c = (https://github.com/pagespeed/mod_pagespeed/blob/master/third_party/apruti= l/apr_memcache2.c) to interact with memcached. >=20 > Recently we've become aware of a bug where we end up hanging in = apr_memcache2_multigetp, pinning cpu at 100%. >=20 > We have some patches which were created in an attempt to fix some = signed bugs in the original code that I think may be causing our issue. >=20 > Namely here: = https://github.com/pagespeed/mod_pagespeed/blob/master/third_party/aprutil= /apr_memcache2.c#L1453 vs here = https://gist.github.com/crowell/59bfa1bb9f0cda30c48a#file-multiget-c-L192 > The original code uses an atoi(), which has undefined behavior when = called on non integer strings, leaving len to be 0. >=20 > Second, the check here = https://github.com/pagespeed/mod_pagespeed/blob/master/third_party/aprutil= /apr_memcache2.c#L1457 vs = https://gist.github.com/crowell/59bfa1bb9f0cda30c48a#file-multiget-c-L199 >=20 > In the original apr code, this check will never fail. len is an = apr_size_t, and will never be < 0. >=20 > The issue here now is that the check in the "server sent back a key = that i didn't ask for" = https://github.com/pagespeed/mod_pagespeed/blob/master/third_party/aprutil= /apr_memcache2.c#L1507 (same in both forked and upstream), = apr_pollset_remove, is never called, and the number of queries sent is = never changed. >=20 > Does it seem possible that this is causing the server to spin here, = and would apr be interested in accepting a patch to fix the signedness = issues? >=20 > Thanks, > Jeff