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 1qHSX8-0001xB-LK for pgsql-admin@arkaria.postgresql.org; Thu, 06 Jul 2023 17:12:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1qHSX6-0006sY-QQ for pgsql-admin@arkaria.postgresql.org; Thu, 06 Jul 2023 17:12:44 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qHSX6-0006s6-5i for pgsql-admin@lists.postgresql.org; Thu, 06 Jul 2023 17:12:44 +0000 Received: from mail-yw1-x1134.google.com ([2607:f8b0:4864:20::1134]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qHSWz-002OLA-7a for pgsql-admin@postgresql.org; Thu, 06 Jul 2023 17:12:42 +0000 Received: by mail-yw1-x1134.google.com with SMTP id 00721157ae682-577ddda6ab1so14064027b3.0 for ; Thu, 06 Jul 2023 10:12:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joeconway.com; s=google; t=1688663556; x=1691255556; h=content-transfer-encoding:in-reply-to:subject:from:references:to :content-language:user-agent:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=bBappfE0siOQhPJ2+cL3GHeYV0FjfRZPa8c/w6pViI0=; b=AOEC5KVBOdr2W580ynNPcb+xK5DQmzGv2wb4kCESj8UGlDO3MrukLI53FWlAHsjKC5 cUh+7pFlp5ZnfLAQB0YDn0tQDjQgt2mJmHKTtdCbm5tZzLzgbjqkLRkS9Noc/7rRftIh khIwALVFcEgu1FTV9FHpVfqFXzhh8MojYtDK0sOenWMCmz5DZs5oBru58+/GT+EG3ftb di0WlVw09JlgER+3KPaHTHaJDZ8myjDjtj2LxJPLQUufrQRoDk/kaiYeaQwalnuH7Pj4 OAPM0p1WBR0kqMKPrDM3Nb3ekK9q3o18xfNq1ysGePz+ZyXmrIo4TONOHyiPUslhcO5v G5Ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688663556; x=1691255556; h=content-transfer-encoding:in-reply-to:subject:from:references:to :content-language:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=bBappfE0siOQhPJ2+cL3GHeYV0FjfRZPa8c/w6pViI0=; b=Je1A8ihvb9I6bLSF2UxrxoqWCxANRnegEczpx3YHJvAGtrt6f1xgkRuKVpSBhcj+hP kt0LJJIZ9Z+XajCUnyx6Jj++H/iUNKgbPe4rXp7ZR3qdE1d+2Rv0meQnV3JH+LSGUZ27 Of4ump5A2iM89HPYsbNYr1Xvvk/Tqac4lN8+g3M4s347OZKL+XvSjxea7G9tVPEFb7/7 /yyIu7gwNfFZsBv142a9ygtMxqYQkjbTvEtsBsh3uYWSNGwQXjkr+L0YZ+NYLNcJf+Gb mHW/KAjMd7bysHBXRsQiWOcjpR9u38Iod47hJCCgepikN2XM4uC5eYupdySsTmuP5Xmg qSPw== X-Gm-Message-State: ABy/qLbZdB0a1ONsKalgEhm9NlHzoKg4dMsFfoNbeaHVWWP7FHr+SOnI RDs5672Dqvl0L7qtoUh9xIEzlPE3foadBLbA98s= X-Google-Smtp-Source: APBJJlGnJAHDLPTutuJ4B7zaeFhIBy+ajXlotSNXHZ1PpKepDDhUoMEzemOoOikXjACwOiM9e1rD1w== X-Received: by 2002:a0d:ea0a:0:b0:56d:1ca0:fa55 with SMTP id t10-20020a0dea0a000000b0056d1ca0fa55mr2018082ywe.25.1688663556070; Thu, 06 Jul 2023 10:12:36 -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 g123-20020a0dc481000000b0057682d3f95fsm472777ywd.136.2023.07.06.10.12.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 06 Jul 2023 10:12:35 -0700 (PDT) Message-ID: <47cb8d14-7288-945e-19d1-655b8117960e@joeconway.com> Date: Thu, 6 Jul 2023 13:12:35 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Content-Language: en-US To: kaido vaikla , pgsql-admin@postgresql.org References: From: Joe Conway Subject: Re: Invoke OOM killer In-Reply-To: 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 7/6/23 12:27, kaido vaikla wrote: > Hi, > > How to invoke OOM killer for pg process? > Some easy "hack" for test purpose. > > OS > Rocky Linux release 9.2 (Blue Onyx) > pg > 15.2 If you are running postgres under systemd, you can add a cgroup memory limit to the unit file. Something like (depending on cgroup version and systemd version the params might be slightly different -- cannot remember off the top of my head): ------- MemoryAccounting=yes MemoryMax=256M ------- Don't forget to ------- systemctl daemon-reload systemctl restart postgresql@15 #or whatever version ------- That will cause an OOM killer strike at 256M of total cgroup usage (all of the postgres processes combined). From there it is pretty easy to trigger by doing something like, e.g. ------- -- attempt to create a ~500M string select repeat('X', 500000000); ------- -- Joe Conway PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com