Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1scH2d-005XgB-0l for pgsql-general@arkaria.postgresql.org; Fri, 09 Aug 2024 04:15:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1scH2b-000wEs-AD for pgsql-general@arkaria.postgresql.org; Fri, 09 Aug 2024 04:15:49 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1scH2a-000wEj-VG for pgsql-general@lists.postgresql.org; Fri, 09 Aug 2024 04:15:48 +0000 Received: from mail-oo1-xc30.google.com ([2607:f8b0:4864:20::c30]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1scH2Y-003uBy-Me for pgsql-general@postgresql.org; Fri, 09 Aug 2024 04:15:48 +0000 Received: by mail-oo1-xc30.google.com with SMTP id 006d021491bc7-5d5e97b84fbso865739eaf.1 for ; Thu, 08 Aug 2024 21:15:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723176944; x=1723781744; darn=postgresql.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=0VnWVuS9ylR2+JPHysixvs9BQ7BiSEq2YmmhVZL9sXs=; b=hDxuxZpKvTnkPANk/rBQJwgtKw3a0NY/71azela51GPHAtdgv8sxwr3vKvN/AEYGwU Ycy1sAhxC5iDs46PtrJlRUOXzHX9cvDE0oA7u5+vTWTBieAR5X0kWedQemIX96HsdgpD UnQwc+iCMZUjw894xXidPUhlPMvJKbEVt1p9Jfc/TGMAwZHrB4RVcIIcW3qEGxwgkfz5 wRl7xgZuLMx4GOKwsPQbhqvdH5WF9MHo0BzXBb+bC3ucTmGamARDqLedTEpsb/nYQWlS HrbTZTvEhAKLzJJ2TKgfNWe0mwH35lx9W7wczZeSOj6Hm3B6SKDSia3ElxH2SjuyFqrK 7n2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723176944; x=1723781744; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=0VnWVuS9ylR2+JPHysixvs9BQ7BiSEq2YmmhVZL9sXs=; b=RWc0eMAph42TWlj68DRD8BbGueomjwyJI/AzP2MilI/B6HNc0q5Bo8SvD3tuN9UIfn sdIuYWRa7kQRw78hxmKh6e25xdoAH+NbGKzOtCrgi05psV8rr39OsH6Xzx2NU8z+exXm ErUkJUBQnNjnfrbNnDym2GqwgIL4IYifd2oXy+7j92C6Gey8m8eLent7dpkhG/Pm1ymz 7sqAL2SBfY+5O5SsdxaP6Z7S+r2A0j/VVT5yz11Ioqg6sX5TjYhbsW8c/eP6JtYdLCrL PALFKy6/75cT5lAYekw4/663WzztF0Xe/CkRHlaBhhiA6bTZZARreen0xJ/J5Spunwxu cyWQ== X-Gm-Message-State: AOJu0YzST8Jg72a4sNAUZGkrKiqBV/ddoX9m+ARYZjxX3lFHjBFapj4+ +JeqviWH7P7TtlmoH8QSmu+TbzxqwAiqRnVP5NWfRBwkasdE5BGLdiMY5bEqeNX5jvdE7no+/qw w95v2ctJl9kCe8N3KI/e9X/6c60IsLQ== X-Google-Smtp-Source: AGHT+IGdGBwYf4+jdHcXE/jeie8xO+8/h6ltavj0A7jjHXvIGtW3Hp0fwOBpX32PRmh3c3selzeD4PtMuDvOb9t+QDI= X-Received: by 2002:a05:6820:1b8d:b0:5d5:6733:ca74 with SMTP id 006d021491bc7-5d867b7bfe1mr529187eaf.2.1723176944505; Thu, 08 Aug 2024 21:15:44 -0700 (PDT) MIME-Version: 1.0 References: <66D17234-043D-457E-8607-5126B4FBC3DD@thebuild.com> In-Reply-To: <66D17234-043D-457E-8607-5126B4FBC3DD@thebuild.com> From: Ron Johnson Date: Fri, 9 Aug 2024 00:15:33 -0400 Message-ID: Subject: Re: Vacuum full connection exhaustion To: pgsql-general Content-Type: multipart/alternative; boundary="000000000000a99ed5061f386565" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000a99ed5061f386565 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Aug 8, 2024 at 10:12=E2=80=AFAM Christophe Pettus wrote: > > > > On Aug 7, 2024, at 10:34, Costa Alexoglou wrote: > > > > Hey folks, > > > > I noticed something weird, and not sure if this is the expected > behaviour or not in PostgreSQL. > > > > So I am running Benchbase (a benchmark framework) with 50 terminals (50 > concurrent connections). > > There are 2-3 additional connections, one for a postgres-exporter > container for example. > > > > So far so good, and with a `max_connections` at 100 there is no problem= . > What happens is that if I execute manually `VACUUM FULL` the connections > are exhausted. > > VACUUM FULL takes an exclusive lock on the table that it is operating on. > It's possible that a connection becomes blocked on that exclusive lock > waiting for the VACUUM FULL to finish, the application sees the connectio= n > stopped and fires up another one (this is common in container-based > applications), that one blocks... until all of the connections are full o= f > queries waiting on that VACUUM FULL. > > "I see a lock, so let's cause another one!" That's crazy. --=20 Death to America, and butter sauce. Iraq lobster! --000000000000a99ed5061f386565 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Thu, Aug 8, 2024 at 10:12=E2=80=AFAM C= hristophe Pettus <xof@thebuild.com> wrote:


> On Aug 7, 2024, at 10:34, Costa Alexoglou <
costa@dbtune.com> wrote:
>
> Hey folks,
>
> I noticed something weird, and not sure if this is the expected behavi= our or not in PostgreSQL.
>
> So I am running Benchbase (a benchmark framework) with 50 terminals (5= 0 concurrent connections).
> There are 2-3 additional connections, one for a postgres-exporter cont= ainer for example.
>
> So far so good, and with a `max_connections` at 100 there is no proble= m. What happens is that if I execute manually `VACUUM FULL` the connections= are exhausted.

VACUUM FULL takes an exclusive lock on the table that it is operating on.= =C2=A0 It's possible that a connection becomes blocked on that exclusiv= e lock waiting for the VACUUM FULL to finish, the application sees the conn= ection stopped and fires up another one (this is common in container-based = applications), that one blocks... until all of the connections are full of = queries waiting on that VACUUM FULL.


"I see a lock, so let's cau= se another one!"=C2=A0 That's crazy.

--
Death to America, and butter sauce.
Iraq l= obster!
--000000000000a99ed5061f386565--