Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j3zEd-0004cw-VP for pgsql-bugs@arkaria.postgresql.org; Tue, 18 Feb 2020 09:32:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j3zEa-0003ds-FJ for pgsql-bugs@arkaria.postgresql.org; Tue, 18 Feb 2020 09:32:04 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from <9erthalion6@gmail.com>) id 1j3zEZ-0003cB-PW for pgsql-bugs@lists.postgresql.org; Tue, 18 Feb 2020 09:32:04 +0000 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from <9erthalion6@gmail.com>) id 1j3zES-00070G-UP for pgsql-bugs@lists.postgresql.org; Tue, 18 Feb 2020 09:32:02 +0000 Received: by mail-wr1-x444.google.com with SMTP id m16so22974159wrx.11 for ; Tue, 18 Feb 2020 01:31:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=b/q79CCk9WhXseaOhXo8wjdq2CNxRB/7kWsLoPtNeHg=; b=Bw6k7c9ALT7wrYkzryTht71ZuYZPfH3X9LTQv2VaLh2TUmUl41KnzcEGO5ZDFVPJ3i O8XnL0plRv6i77LDxRfljYiGrauq7zKnSz6ww32ol2KAFb6OXeM1FyXcObU/Fhe64e+9 aqZDgRnAEMe2HhzUVzDIAmOiSAN34WXSsO5HmCiIshcY21GH/MrqerR27O2wz6C7fL2M lVvpxtAcycNkHnGBDdLwYT3m5OswyPlC0hSJGn+8dN/rYhmNNOgSv4uwfEn39D4acrh0 gHPC+qXLzXSggIPGOMDU+yVhtFSpQP+ix/OrCC7JA7A5/0h8OZXzlPKSKYEq0029dMr7 fJgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=b/q79CCk9WhXseaOhXo8wjdq2CNxRB/7kWsLoPtNeHg=; b=qKlG46wGzNUPyr7oMbBVTt/nZCPTuO+ZZAxChTef587ZdoQLYuhvITNaTAEFAv3t1i x0g0Sd9OIfj3rFc28Na6gA/hTAFq+MyhmsXEMcoauyqvOOXqdPt5zCpDMFtcGTIDivaO dCe3kaCDShU5a/LizUy38qFV+tWJkKKO3wQ0j51pVfJdrXk+/SoexbWCMrKLT/16WyPM vQIdvdsjnVL2cOjxpYy/EoKa3N16tbwn0nXwTEx3e0iiAM35TfSbu0l67VZk2eqgmKrq NhWYrFDdtmxz/z2JGE9Rn98LVVtLBISnmmqxf9vuOzkxmiEFFFVaiSwbvW9pY9GSSKLW nFlg== X-Gm-Message-State: APjAAAVQWqXOjq1JijgTDDmRYfANYoGCgp7r5Sagf2Cnaxvme15gf9Wo 7il4NkeKjnVsTfyhu9Kt+Kk= X-Google-Smtp-Source: APXvYqyeNiSqVN5DNO2n3cuXaqifNfygEE8/YCS46wvECXWLgg69lGhi9gO6P8Bleo9xL/rxfJhciQ== X-Received: by 2002:adf:f401:: with SMTP id g1mr27308798wro.129.1582018315002; Tue, 18 Feb 2020 01:31:55 -0800 (PST) Received: from localhost ([185.85.220.200]) by smtp.gmail.com with ESMTPSA id a6sm5195337wrm.69.2020.02.18.01.31.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Feb 2020 01:31:54 -0800 (PST) Date: Tue, 18 Feb 2020 10:32:40 +0100 From: Dmitry Dolgov <9erthalion6@gmail.com> To: Fan Liu Cc: "pgsql-bugs@lists.postgresql.org" Subject: Re: [Bus error] huge_pages default value (try) not fall back Message-ID: <20200218093240.jd3lgoxmisyl2tt5@localhost> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk > On Tue, Feb 18, 2020 at 07:52:50AM +0000, Fan Liu wrote: > Hi, > > We have seen a bus error when running postgresql in container (where on K8s). According current finding, there is bug on K8s, they are working on it. > But we also want to know why huge_pages default value(try) didn't fall back. > > K8s BUG https://github.com/kubernetes/kubernetes/issues/71233 > > Problem quick summary: > When hugepage not working, initdb produce bus error. Thanks for reporting! This one is fun. If I understand everything correctly, Postgres will fall back to non huge pages if it fails to allocate some. But in this case kernel actually allocates everything without problems (there are some available huge pages on a node after all), and return SIGBUS only when a first page fault within this cgroup happened, see the docs [1]: The HugeTLB controller allows to limit the HugeTLB usage per control group and enforces the controller limit during page fault. Since HugeTLB doesn't support page reclaim, enforcing the limit at page fault time implies that, the application will get SIGBUS signal if it tries to access HugeTLB pages beyond its limit. This requires the application to know beforehand how much HugeTLB pages it would require for its use. Unfortunately I'm not sure what would be the best solution in this situation. [1]: https://www.kernel.org/doc/html/latest/_sources/admin-guide/cgroup-v1/hugetlb.rst.txt