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 1pbnZ8-0003oR-7E for pgsql-general@arkaria.postgresql.org; Mon, 13 Mar 2023 19:10:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pbnZ6-0002tM-4L for pgsql-general@arkaria.postgresql.org; Mon, 13 Mar 2023 19:10:36 +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 1pbnZ5-0002sr-Pw for pgsql-general@lists.postgresql.org; Mon, 13 Mar 2023 19:10:35 +0000 Received: from mail-qt1-x830.google.com ([2607:f8b0:4864:20::830]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pbnZ2-0002UW-Bs for pgsql-general@lists.postgresql.org; Mon, 13 Mar 2023 19:10:35 +0000 Received: by mail-qt1-x830.google.com with SMTP id w23so14372119qtn.6 for ; Mon, 13 Mar 2023 12:10:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joeconway.com; s=google; t=1678734630; h=content-transfer-encoding:in-reply-to:subject:from:references:cc:to :content-language:user-agent:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=bJ77p5rKbPgUJWDQ4UjiydfvlUoDcIEp5rZZbeIxNEA=; b=Jrtw3SSqD4hr/QEbVCGBKgZCt2UpiDC8W3y95HIZzaMya19TANXSizBN/Ioln3Brlk jaswcc8hXm0SATZ9IMszjWNuqZCfOOcNq2XZVvMV8O6GlUcETf4BDK8Vf02UoXCkJw/7 vc/dkw3bRbhauuCE1Is3QQtZ55KWD/+aIz2oodyoNGAd8TZafelt5WwTpYRHqoSWEN2C 2qSZQ6vgAolnYjqAusos6Y7866p27Fnq3ntt7SkXKrYUMmXmKnG6lpsHPDtdZv5uR6VG tWEZqFeqsdH57dWIPcFKSBtW1Bm6qOpfFM6cYHm5a2+ul10aBPNcZuHtEVLj+2NejUZL tjiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678734630; h=content-transfer-encoding:in-reply-to:subject:from:references:cc:to :content-language:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=bJ77p5rKbPgUJWDQ4UjiydfvlUoDcIEp5rZZbeIxNEA=; b=7N5l7hnbBr3VIOt1KQ8HzpWh88cllTrUykE85WvAc+eGEKFZW188B+L25GrLjqcpGL Po1ak/zdK2g3D6NGoksntsrVKxCvZ41dLgKs5MZM9SJydgNuiWmMjXxIa+ZcWqKoq8Eq ByzZb5HdAyb2+axzmPiJJwr/l91DPnreXQGEKHHVTtcvaJChZPPxdY/Rh9trPma+cxen 1+TZPzjNZJr1+Q0sgYDetnRupGbKjakDkNmqiMa5y5GOJzp5cJsEIkTOGTm/rn4qz2zP 0Ph4imHFKnSwZUwvSqHeuBkx3TmpKCyz/fb6tVzcpGn3+CuQqS+ao51PkUqyhbrdKRvh NYMA== X-Gm-Message-State: AO0yUKXGuZkq11N55yFaTv3twDwZycvHrADIZhr+ASVA2pbLmrHvYTRg a94ojxRHRkiqW0LwezM5re6rig== X-Google-Smtp-Source: AK7set/9pe9AOQS8RAQmt4PqllJzn8jSkt6lX7/Fgze3bjpds785/CziVBeTAN/2BMPI1030Hx+wNg== X-Received: by 2002:a05:622a:54e:b0:3bf:c86b:3d2a with SMTP id m14-20020a05622a054e00b003bfc86b3d2amr55112052qtx.9.1678734630310; Mon, 13 Mar 2023 12:10:30 -0700 (PDT) Received: from [192.168.4.41] (162-239-31-113.lightspeed.dybhfl.sbcglobal.net. [162.239.31.113]) by smtp.gmail.com with ESMTPSA id n22-20020ac81e16000000b003afbf704c7csm375963qtl.24.2023.03.13.12.10.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 13 Mar 2023 12:10:29 -0700 (PDT) Message-ID: Date: Mon, 13 Mar 2023 15:10:29 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Content-Language: en-US To: Israel Brewster Cc: "Peter J. Holzer" , pgsql-general@lists.postgresql.org References: <20230313174301.23n6crb5dpttozup@hjp.at> <03239776-b0c6-94a8-7bb3-a1af363d745f@joeconway.com> <9616AB47-E78B-49FD-81AE-41015E13AADC@alaska.edu> From: Joe Conway Subject: Re: Properly handle OOM death? In-Reply-To: <9616AB47-E78B-49FD-81AE-41015E13AADC@alaska.edu> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 3/13/23 14:50, Israel Brewster wrote: > Looks like V2: > > root@novarupta:~# stat -fc %T /sys/fs/cgroup/ > cgroup2fs Interesting -- it does indeed look like you are using cgroup v2 So the file you want to look at in that case is: 8<----------- cat /sys/fs/cgroup/system.slice/system-postgresql.slice/postgresql@14.service/memory.max 4294967296 cat /sys/fs/cgroup/system.slice/system-postgresql.slice/postgresql@14.service/memory.high 3221225472 8<----------- If the value comes back as "max" it means no limit is set. In this example (on my Linux Mint machine with a custom systemd unit file) I have memory.max set to 4G and memory.high set to 3G. The value of memory.max determines when the OOM killer will strike. The value of memory.high will determine when the kernel goes into aggressive memory reclaim (trying to avoid memory.max and thus an OOM kill). The corresponding/relevant systemd unit file parameters are: 8<----------- MemoryAccounting=yes MemoryHigh=3G MemoryMax=4G 8<----------- There are other ways that memory.max may get set, but it seems most likely that the systemd unit file is doing it (if it is in fact set). -- Joe Conway PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com