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 5C879DC5D95 for ; Tue, 23 Feb 2016 15:36:05 +0000 (UTC) Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.alpinelinux.org (Postfix) with ESMTPS id EADE3DC2BCC for ; Tue, 23 Feb 2016 15:36:03 +0000 (UTC) Received: from mfilter26-d.gandi.net (mfilter26-d.gandi.net [217.70.178.154]) by relay6-d.mail.gandi.net (Postfix) with ESMTP id 2E1A2FB8E3; Tue, 23 Feb 2016 16:36:01 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mfilter26-d.gandi.net Received: from relay6-d.mail.gandi.net ([IPv6:::ffff:217.70.183.198]) by mfilter26-d.gandi.net (mfilter26-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id nY2JhY5OJeYn; Tue, 23 Feb 2016 16:35:59 +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 relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 72368FB89E; Tue, 23 Feb 2016 16:35:59 +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: <20160223170446.483be803@vostro.util.wtbts.net> Date: Tue, 23 Feb 2016 16:35:58 +0100 Cc: alpine-aports@lists.alpinelinux.org Content-Transfer-Encoding: quoted-printable Message-Id: 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> To: Timo Teras X-Mailer: Apple Mail (2.3112) X-Virus-Scanned: ClamAV using ClamSMTP > Le 23 f=C3=A9vr. 2016 =C3=A0 16:04, Timo Teras a = =C3=A9crit : >=20 > On Tue, 23 Feb 2016 15:41:23 +0100 > Marc Vertes wrote: >=20 >> It doesn't work. And on my side, I tried a similar modification >> (using getrlimit) in >> src/third_party/mozjs-38/extract/js/src/jsnativestack.cpp without >> success.=20 >>=20 >> But I found a separate patch which works: >>=20 >> --- src/mongo/scripting/mozjs/implscope.cpp.orig >> +++ src/mongo/scripting/mozjs/implscope.cpp >> @@ -258,6 +258,7 @@ >> // >> // TODO: What if we are running on a platform with very >> // large pages, like 4MB? >> + //JS_SetNativeStackQuota(_runtime, available.get() - (64 >> * 1024)); JS_SetNativeStackQuota(_runtime, available.get() - (32 * >> 1024)); } >>=20 >> So I believe that it should be a matter of increasing allocated stack >> at thread creation. I'm still not able to do that, despite my various >> attempts. >=20 > The main thread's stack is allocated by kernel. In practice, kernel > maps the stack on virtual address space so that it's size is the > stack rlimit, but it only allocates the first pages of it. When the > stack is needed more, the kernel automatically commits/allocates more > of the stack. >=20 > Musl returns you the actual size of the stack in use. Glibc returns = you > the maximum stack size (but kernel might fail to allocate it). >=20 > Another attempt would be to patch that function to have in the > beginning a call to function that has large stack array and that = writes > to it. >=20 > Something like: >=20 > static void commit_stack(void) > { > char foo[1024*1024*2]; > foo[0] =3D foo[sizeof(foo)-1] =3D 0; > } >=20 > Assuming gcc will not optimize it away. >=20 > After this kernel should commit the memory, and musl's > pthread_getattr_np should return value reflecting that. 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). Changing size does nothing. I also noticed that pthread_getattr_np and pthread_attr_getstack where = not performed from the main thread (gettid !=3D getpid) Marc= --- Unsubscribe: alpine-aports+unsubscribe@lists.alpinelinux.org Help: alpine-aports+help@lists.alpinelinux.org ---