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 1oAqJo-0003eH-Ia for pgsql-general@arkaria.postgresql.org; Mon, 11 Jul 2022 10:07:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oAqJn-0006QS-8y for pgsql-general@arkaria.postgresql.org; Mon, 11 Jul 2022 10:07:07 +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 1oAqJm-0006Ol-Ut for pgsql-general@lists.postgresql.org; Mon, 11 Jul 2022 10:07:06 +0000 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oAqJk-0005aH-AC for pgsql-general@lists.postgresql.org; Mon, 11 Jul 2022 10:07:05 +0000 Received: by mail-pj1-x102a.google.com with SMTP id s21so4407591pjq.4 for ; Mon, 11 Jul 2022 03:07:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:cc:in-reply-to:to; bh=et7VsOp6122A2dPdZO9GjhDDoY2dQ7gYFMimuY0uCfQ=; b=p+eKVuJDsg5G58A+PCPA12CMlEDdz/waTuz5NCc31K0WsFXxekEcX5KDEoQgKCfN+N HbyYfzApDzsf7IfoBqqBut48fVBskfwSqrud88D223KgVEImWnjSq9H2tLJMvlTBzxvs uu5sZpUj4PIdfEU27KLN8D/OE0kYysjgpW3GShGm/jyDSdM84UntsGYhVvzOXhSdIu3Q FVNpND+SBRRUh/52293fWTsfh4q14mMoac+4I4+z5peMqhWKLeJ1EccTKwEOl7ZSejh9 zwxLM8VaRJ8hFV27lagAe911TQiuLnJucA0Pi7A/23+k5T91HtGeWVzHsXm69Rct1Ia+ ++0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=et7VsOp6122A2dPdZO9GjhDDoY2dQ7gYFMimuY0uCfQ=; b=gUGQKirCxNnN9SIzeUCOM2Jld/M2cLGvNDlR35dkA0ph2MDVH12Yu44plTXeBmsSBR FouDhBwHr12sXHPk+VW/a/ZydLT2pDG/+AP/oMlwwrgfLbIOVNVsxXlxpTD6fFQRqXF1 Laqulff2QpXWPoiLPBxlh5QRMrXCWoX6ML5MDDx/9CAUeybM0f2AccWLwBgTmaSY209o mFrje+1XqJPTVNbXPRKawsMC3HkJXhQgG5ORU3+dHX4mtMxr373XZKoI1Uug2dWbdsx/ CNALip+8EDMMPBgG1hOnovNOWLHeJSmNDEnH+poQbmvc475KDJcjNyS/1QX2Bi0XFZIO d1tA== X-Gm-Message-State: AJIora9DWR3dssK6VIUEEQ37ISpONb4KtDfiAYHln0gKRhdIFsqJxNww QgOl26g0a7muvXMEU9tACEdReiTF/gXkXQ== X-Google-Smtp-Source: AGRyM1tQhHE+4bGN2LgdcX6pGQMuofZgOF7iuPPshAM987+z/hDVKhVc5bfd7ClACMdPLVs4pr7POA== X-Received: by 2002:a17:902:d581:b0:16b:e6b8:4080 with SMTP id k1-20020a170902d58100b0016be6b84080mr17991979plh.146.1657534022960; Mon, 11 Jul 2022 03:07:02 -0700 (PDT) Received: from smtpclient.apple ([2601:681:5a00:820:4575:913d:bbaa:8a7f]) by smtp.gmail.com with ESMTPSA id kk8-20020a17090b4a0800b001ef899eb51fsm6636475pjb.29.2022.07.11.03.07.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 11 Jul 2022 03:07:02 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Rob Sargent Mime-Version: 1.0 (1.0) Subject: Re: PostgreSQL 14.4 ERROR: out of memory issues Date: Mon, 11 Jul 2022 04:07:00 -0600 Message-Id: <25016EDA-F9BF-419A-B58D-0CE2199C5B95@gmail.com> References: Cc: "pgsql-generallists.postgresql.org" In-Reply-To: To: =?utf-8?Q?Ale=C5=A1_Zelen=C3=BD?= X-Mailer: iPhone Mail (19F77) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Jul 11, 2022, at 2:50 AM, Ale=C5=A1 Zelen=C3=BD = wrote: >=20 > =EF=BB=BF > Hello, >=20 > we are experiencing out-of-memory issues after Postygres upgrade from 14.3= to 14.4 on CentOS7. >=20 > OS: CenotOS7 >=20 > No OOM killer messages in the syslog. SWAP is disabled. >=20 > -bash-4.2$ sysctl -q vm.overcommit_memory > vm.overcommit_memory =3D 2 >=20 > [root@sts-uat-pgsql100 ~]# swapon -vs > [root@sts-uat-pgsql100 ~]#=20 >=20 > [root@sts-uat-pgsql100 ~]# sysctl -q vm.overcommit_ratio > vm.overcommit_ratio =3D 95 >=20 >=20 > -bash-4.2$ uname -r > 3.10.0-1160.42.2.el7.x86_64 >=20 > -bash-4.2$ free -h > total used free shared buff/cache avai= lable > Mem: 39G 7,8G 220M 10G 31G = 20G > Swap: 0B 0B 0B >=20 >=20 >=20 > postgres=3D# show shared_buffers ; > shared_buffers > ---------------- > 10GB > (1 row) >=20 > postgres=3D# show work_mem ; > work_mem > ---------- > 4MB > (1 row) >=20 > postgres=3D# show maintenance_work_mem ; > maintenance_work_mem > ---------------------- > 512MB > (1 row) >=20 > postgres=3D# show max_parallel_workers; > max_parallel_workers > ---------------------- > 8 > (1 row) >=20 > postgres=3D# show max_parallel_maintenance_workers ; > max_parallel_maintenance_workers > ---------------------------------- > 2 > (1 row) >=20 > postgres=3D# select count(*) from pg_stat_activity ; > count > ------- > 93 > (1 row) >=20 > postgres=3D# show max_connections ; > max_connections > ----------------- > 1000 > (1 row) >=20 > No changes on the application side were made before the out-of-memory happ= ened. >=20 >=20 >=20 > So far, it has happened three times (during a single week) from the 14.3 -= > 14.4 upgrade, before 14.4 we haven't suffered from such an issue. >=20 > Questions:e.=20 > 1) Can we safely downgrade from 14.4 to 14.3 by shutting down the instanc= e and reinstalling 14.3 PG packages (to prove, that the issue disappear)? > 2) What is the best way to diagnose what is the root cause? You can turn on sql logging to see what query is causing the crash.=20 Has any new code added anything with=20 a.id!=3D b.id on any large table? What we have started to collect: When you think you see it happening you can query the System tables for currently running queries. pg_stat* > - vmstat -nwt (per second) > - vmstat -nawt (per