Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bKSg1-0000Cn-Mw for pgsql-hackers@arkaria.postgresql.org; Tue, 05 Jul 2016 15:54:21 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bKSg0-0003LA-I4 for pgsql-hackers@arkaria.postgresql.org; Tue, 05 Jul 2016 15:54:20 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bKSfz-0003KD-5i for pgsql-hackers@postgresql.org; Tue, 05 Jul 2016 15:54:19 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bKSfs-0008Ky-FN for pgsql-hackers@postgresql.org; Tue, 05 Jul 2016 15:54:18 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u65FsAEn032730; Tue, 5 Jul 2016 11:54:10 -0400 From: Tom Lane To: Greg Stark cc: PostgreSQL-development Subject: Re: can we optimize STACK_DEPTH_SLOP In-reply-to: References: Comments: In-reply-to Greg Stark message dated "Tue, 05 Jul 2016 14:41:50 +0100" Date: Tue, 05 Jul 2016 11:54:10 -0400 Message-ID: <32729.1467734050@sss.pgh.pa.us> X-Pg-Spam-Score: -3.2 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Greg Stark writes: > Poking at NetBSD kernel source it looks like the default ulimit -s > depends on the architecture and ranges from 512k to 16M. Postgres > insists on max_stack_depth being STACK_DEPTH_SLOP -- ie 512kB -- less > than the ulimit setting making it impossible to start up on > architectures with a default of 512kB without raising the ulimit. > If we could just lower it to 384kB then Postgres would start up but I > wonder if we should just use MIN(stack_rlimit/2, STACK > _DEPTH_SLOP) so that there's always a setting of max_stack_depth that > would allow Postgres to start. I'm pretty nervous about reducing that materially without any investigation into how much of the slop we actually use. Our assumption so far has generally been that only recursive routines need to have any stack depth check; but there are plenty of very deep non-recursive call paths. I do not think we're doing people any favors by letting them skip fooling with "ulimit -s" if the result is that their database crashes under stress. For that matter, even if we were sure we'd produce a "stack too deep" error rather than crashing, that's still not very nice if it happens on run-of-the-mill queries. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers