X-Original-To: alpine-aports@mail.alpinelinux.org Delivered-To: alpine-aports@mail.alpinelinux.org Received: from mail.alpinelinux.org (dallas-a1.alpinelinux.org [127.0.0.1]) by mail.alpinelinux.org (Postfix) with ESMTP id D30BADCB75A for ; Tue, 23 Feb 2016 16:10:53 +0000 (UTC) Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.alpinelinux.org (Postfix) with ESMTPS id 83466DC03EA for ; Tue, 23 Feb 2016 16:10:50 +0000 (UTC) Received: from mfilter10-d.gandi.net (mfilter10-d.gandi.net [217.70.178.139]) by relay4-d.mail.gandi.net (Postfix) with ESMTP id 0F90A1720F1; Tue, 23 Feb 2016 17:10:48 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mfilter10-d.gandi.net Received: from relay4-d.mail.gandi.net ([IPv6:::ffff:217.70.183.196]) by mfilter10-d.gandi.net (mfilter10-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id b-1QwU8hIRli; Tue, 23 Feb 2016 17:10:46 +0100 (CET) X-Originating-IP: 193.248.36.207 Received: from [192.168.1.217] (LCaen-656-1-170-207.w193-248.abo.wanadoo.fr [193.248.36.207]) (Authenticated sender: marc.vertes@ugrid.net) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id B8E541720D6; Tue, 23 Feb 2016 17:10:45 +0100 (CET) Content-Type: text/plain; charset=utf-8 X-Mailinglist: alpine-aports Precedence: list List-Id: Alpine Development List-Unsubscribe: List-Post: List-Help: List-Subscribe: Mime-Version: 1.0 (Mac OS X Mail 9.2 \(3112\)) Subject: Re: [alpine-aports] [PATCH] testing/mongodb: fix bug #5117 where mongo fails at start From: Marc Vertes In-Reply-To: <20160223175029.23bcadb2@vostro> Date: Tue, 23 Feb 2016 17:10:44 +0100 Cc: alpine-aports@lists.alpinelinux.org Content-Transfer-Encoding: quoted-printable Message-Id: <339A4F58-917F-455E-9B0E-E1E5A5902ADE@ugrid.net> References: <1456083383-9196-1-git-send-email-marc.vertes@ugrid.net> <20160223150743.33e55efa@vostro.util.wtbts.net> <9D775D86-8A4D-49ED-8512-EBD572ECF6D6@ugrid.net> <20160223170446.483be803@vostro.util.wtbts.net> <20160223175029.23bcadb2@vostro> To: Timo Teras X-Mailer: Apple Mail (2.3112) X-Virus-Scanned: ClamAV using ClamSMTP > Le 23 f=C3=A9vr. 2016 =C3=A0 16:50, Timo Teras a = =C3=A9crit : >=20 > On Tue, 23 Feb 2016 16:35:58 +0100 > Marc Vertes wrote: >=20 >> No success. I think that the base address returned by >> pthread_attr_getstack(&attr, &base, &size) is the problem. Increasing >> the size (like with getrlimit) doesn't change the test in >> StackLocator.available() which triggers abort: it checks the >> available space against this base address (&localaddr - base > = quota). >>=20 >> Changing size does nothing. >>=20 >> I also noticed that pthread_getattr_np and pthread_attr_getstack >> where not performed from the main thread (gettid !=3D getpid) >=20 > Right. ulimit should be used only for main thread. Not the created > threads with libc allocated stack. That needs a fix. >=20 > pthread_attr_getstack should return the lowest addressable byte of the > stack. So indeed, if we change the size, we need to adjust base > accordingly on system with downward growing stack. Something like: >=20 > --- = mongodb-src-r3.2.1.orig/src/mongo/platform/stack_locator_pthread_getattr_n= p.cpp > +++ = mongodb-src-r3.2.1/src/mongo/platform/stack_locator_pthread_getattr_np.cpp= > @@ -31,6 +31,7 @@ > #include "mongo/platform/stack_locator.h" >=20 > #include > +#include >=20 > #include "mongo/util/assert_util.h" > #include "mongo/util/scopeguard.h" > @@ -52,6 +53,13 @@ > invariant(result =3D=3D 0); > invariant(base !=3D nullptr); > invariant(size !=3D 0); > + > + struct rlimit rl; > + > + base +=3D size; > + invariant(getrlimit(RLIMIT_STACK, &rl) =3D=3D 0); > + size =3D rl.rlim_cur ? : 2 * 1024 * 1024; > + base -=3D size; >=20 > // TODO: Assumes a downward growing stack. Note here that > // getstack returns the stack *base*, being the bottom of the >=20 This one works! But I'm afraid of possible stack overlap between threads if it is run = not from main thread. Is it your concern too ? Marc= --- Unsubscribe: alpine-aports+unsubscribe@lists.alpinelinux.org Help: alpine-aports+help@lists.alpinelinux.org ---