Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pJNIm-0004Aq-D2 for pgsql-bugs@arkaria.postgresql.org; Sat, 21 Jan 2023 23:29:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pJNIj-0003z4-DM for pgsql-bugs@arkaria.postgresql.org; Sat, 21 Jan 2023 23:29:33 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pJNIj-0003yu-54 for pgsql-bugs@lists.postgresql.org; Sat, 21 Jan 2023 23:29:33 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pJNIc-0006fB-77 for pgsql-bugs@lists.postgresql.org; Sat, 21 Jan 2023 23:29:32 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 37D0D5C00AC; Sat, 21 Jan 2023 18:29:24 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Sat, 21 Jan 2023 18:29:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= cc:cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm3; t=1674343764; x=1674430164; bh=4gG82KqW3f luQUyZQ1GsUNiT35I8ih0OSf08y+zqpqQ=; b=DFymToaJ4+0kj4xURlS91Dksvy UIiazT0hHC4Yc6HX905qW4ObFsW/b+2VMUT2TvwxNWXFcRLFgIYRq+QjpiImlYHV kbGAPt6OGocoUD3rVbv5cPcQKEyej2QDth0o1LG29szwK2+uNi1NS880hqSzcLPU kO7OoLUCyybdbrTw2RD1TnX0Y9HvERqejn3thEo1231BIpXuhsYAQW/9JScA/7Ld SD8huI4VxYQKrDwGojBLowMTHDgZFtYiq5NLKLbwEAvWqeYUJIGAC8NbKZ+Tnqlr +oJpth1t4XddsrEAgnIAe6PcZmcwCoU65/BrYCXNz3gFCUOedc0OH79LzIZg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1674343764; x=1674430164; bh=4gG82KqW3fluQUyZQ1GsUNiT35I8 ih0OSf08y+zqpqQ=; b=LCke5e7i6+BRcMQGc+LC7VdWJVCpnsXXE7fpAvJhHBOr FKVxA3o1oTX+YmpmZDIXR3UE5lKmF8cQHt+x0TmV3rPfQMxrJZZR1J350JUOOyJz hOXtp3CvOICqoQNMSbVniHJ49tNi0oA3287YoZ6rcgnJY68p8O0PtUKh6+DasTxs cYqkoWeVUSlj2QbPfEv0unEgOufP7nLfRCtOTlNcj1l7kc6MN0uahugD4yv3ANFf Djw3lIi2LWT0ViJ1kwzyg4QsPe8lsuPH28IyP8jrw8NwyFZ5ZaARG1a4vLgl7vSe wzoobH/jL6uU4JlTSL0XFqbsOchc4NQ7/jIzUL8hMw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudduhedgtdelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvdenucfhrhhomheptehnughr vghsucfhrhgvuhhnugcuoegrnhgurhgvshesrghnrghrrgiivghlrdguvgeqnecuggftrf grthhtvghrnhephefftdffheduffehffdtgfejgffhveehueeivdfhfefhfeekheeugfeg fefgleffnecuffhomhgrihhnpehgihhthhhusgdrtghomhenucevlhhushhtvghrufhiii gvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrnhgurhgvshesrghnrghrrgiivghl rdguvg X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 21 Jan 2023 18:29:23 -0500 (EST) Date: Sat, 21 Jan 2023 15:29:22 -0800 From: Andres Freund To: Tomas Vondra Cc: david_sisson@dell.com, pgsql-bugs@lists.postgresql.org, PG Bug reporting form Subject: Re: BUG #17757: Not honoring huge_pages setting during initdb causes DB crash in Kubernetes Message-ID: <20230121232922.juo7t3fhaso7qh3s@awork3.anarazel.de> References: <17757-dbdfc1f1c954a6db@postgresql.org> <4ce40288-5b88-f9fb-ea11-fc932c61472b@enterprisedb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4ce40288-5b88-f9fb-ea11-fc932c61472b@enterprisedb.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2023-01-22 00:10:29 +0100, Tomas Vondra wrote: > On 1/20/23 23:48, PG Bug reporting form wrote: > > In these cases, the initdb phase will attempt to allocate huge pages that > > are available in the OS, but it will be denied access by Kubernetes and > > fail. > > Well, so how exactly this fails? Does that mean Kubernetes broke mmap() > with MAP_HUGETLB so that it doesn't return MAP_FAILED when hugepages are > not available, or what? Because that's the only explanation I can see, > looking at the code. Yea, that's what I was wondering about as well. > Or it just does not realize there are no hugepages, returns something > and then crashes with SIGBUS later when trying to access it? I assume that that's the case. There's references to bus errors in a bunch of the linked issues. E.g. https://github.com/CrunchyData/postgres-operator/issues/413 selecting default max_connections ... sh: line 1: 60 Bus error (core dumped) "/usr/pgsql-10/bin/postgres" --boot -x0 -F -c max_connections=100 -c shared_buffers=1000 -c dynamic_shared_memory_type=none < "/dev/null" > "/dev/null" 2>&1 It's possible that the problem would go away if we used MAP_POPULATE for the allocation. I'd guess that this is annoying cgroups stuff :( > I doubt we want to just go straight to changing the default value for > everyone. IMHO if the "try" logic is somehow broken, we should fix the > try logic, not mess with the defaults. Agreed. But we could disable huge pages explicitly inside initdb - there's really no point in using it there... Greetings, Andres Freund