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.96) (envelope-from ) id 1woWCZ-0016Qi-2b for pgpool-general@arkaria.postgresql.org; Tue, 28 Jul 2026 01:01:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1woWCY-00Fd68-2j for pgpool-general@arkaria.postgresql.org; Tue, 28 Jul 2026 01:01:46 +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.96) (envelope-from ) id 1woWCY-00Fd5z-25 for pgpool-general@lists.postgresql.org; Tue, 28 Jul 2026 01:01:46 +0000 Received: from meldrar.postgresql.org ([2a02:c0:301:0:ffff::31]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1woWCV-00000000dTu-3QHc for pgpool-general@lists.postgresql.org; Tue, 28 Jul 2026 01:01:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=postgresql.org; s=20171124; h=Content-Transfer-Encoding:Content-Type: Mime-Version:References:In-Reply-To:From:Subject:Cc:To:Message-Id:Date:Sender :Reply-To:Content-ID:Content-Description; bh=Ed9c1QBAkVvy9FGiIAqHytKqqpUHm9broa+NEycenfM=; b=zIKlZmRkHDuzoNTKDH2GA0NOIi aPU3q/3+RdHfiFIUrR65iGSuVIxRA2eCk7djD3tnZ43e21b86vWp7xmO42BGoXaeey/3mk42I3QSB KWMBHHU58t8FYaBroDRSBXxhyyJpLcc1e8t4xf4J9OsWuBPI0rCe6YjmOjUE36vyK+EPnLhzTrYKt NeLZORNyyZyZQgFN/Gv10+efp9cdG/++gMZ1ptEEtMzOm99j1kgXOUNEM6dcJipU97WAF1guSP+r4 hRrPiBgJqrqEPrMuDqG7MmLbRF9QVIC3O+NJlBJqE6G2C0UJDoY77nA55bYixtcd2GZn7x0vyYVcP jupDOkbQ==; Received: from [2409:11:4120:300:4e48:a724:7a73:7bc0] (helo=localhost) by meldrar.postgresql.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1woWCT-00000001Ks3-1S68; Tue, 28 Jul 2026 01:01:43 +0000 Date: Tue, 28 Jul 2026 10:01:31 +0900 (JST) Message-Id: <20260728.100131.1277286284360653494.ishii@postgresql.org> To: a.mantzios@cloud.gatewaynet.com Cc: pgpool-general@lists.postgresql.org Subject: Re: low level protocol, implicit transactions , "idle in transaction" issue From: Tatsuo Ishii In-Reply-To: <22c751e9-fbf5-4dc0-b254-5b8e8adac818@cloud.gatewaynet.com> References: <754bc89e-abab-43a9-bf7e-1b3acf73d931@cloud.gatewaynet.com> <20260724.075234.1074150663970997670.ishii@postgresql.org> <22c751e9-fbf5-4dc0-b254-5b8e8adac818@cloud.gatewaynet.com> X-Mailer: Mew version 6.8 on Emacs 29.3 Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2409:11:4120:300:4e48:a724:7a73:7bc0 (failed) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk >>> sorry I forgot to mention, >>> >>> before the patch, disabling the query cache in pgpool the problem w= ent >>> away. >>> >>> On 7/22/26 17:32, Achilleas Mantzios wrote: >>>> Dear pgpool team >>>> >>>> This is our setup : >>>> >>>> Quarkus (Agroal) -> pgbouncer-1.25.1 -> pgpool 4.7.2 -> pgsql 18.3= >>>> >>>> We noticed that with no explicit transactions, at start up SQL que= ries >>>> (application_name, search_path, etc), we experienced random 'idle = in >>>> transaction' connections from pgpool -> pgsql. >>>> >>>> Bypassing pgpool, i.e. pgbouncer -> directly to pgsql , the issue = was >>>> not there. >>>> >>>> So, bypassing the past excellent relation and collaboration I had = with >>>> you guys,=A0 I got into the temptation to use our local AI cli age= nt >>>> (against our local GLM-5.2-NVFP4=A0) from within pgpool 4.7.2 code= base >>>> and try to see what's going on. >>>> >>>> So it gave it a thorough examination, looked at past issues, etc a= nd >>>> it came up with a patch. It applied the patch , compiled and >>>> installed, and I only had to restart pgpool. >>>> >>>> The problem seems gone . >>>> >>>> I attach the patch. Please review and tell me your thoughts. I Kno= w I >>>> should maybe go the classic route, mailing list, advice from you, = full >>>> logging, etc till I demo the issue, but the time is pushing us har= d. >>>> >>>> Thank you! >> So your problem occurs only if following conditions are all met: >> >> 1) query cache is enabled >> 2) no explicit transaction is used >> 3) extended query protocol is used >> >> Am I correct? > = > Yes exactly! So I trited to reprodce the issue using pgproto. Tool chain is: pgproto->pgpool->PostgreSQL pgpool.conf is set up by pgpool_setup and I added followings to pgpool.= conf. memory_cache_enabled =3D on log_min_messages =3D debug1 reset_query_list =3D 'ABORT' I set reset_query_list to exclude "DISCARD ALL" since if it's included, PostgreSQL complains that DISCARD ALL cannot be executed inside transaction. This issue needs to be solved but I think it's not related to your issue. Here is the test data for pgproto. 'P' "" "SELECT * FROM t1" 0 'B' "" "" 0 0 0 'D' 'P' "" 'E' "" 0 'S' 'Y' 'X' This executes parse (SELECT * FROM t1, using unnamed statement), bind (using unnamed portal), Describye, Execute and Sync. Here is the result from pg_stat_activity. psql -p 11002 -c "select state,query from pg_stat_activity where backen= d_type =3D 'client backend'" test state | query = = --------+--------------------------------------------------------------= ------------------ idle | SELECT oid FROM pg_catalog.pg_database WHERE datname =3D 'tes= t' active | select state,query from pg_stat_activity where backend_type =3D= 'client backend' (2 rows) So the "state" was "idle", not "idle in transaction". I am wondering why you get "idle in trasaction" without issuing an explicit transaction from your side. Is it possible that your tool chain always start a trasanction internally? What would happen if you bypass pgbouncer? Anyway, adding: log_client_messages =3D on will record helpful pgpool.log. Regards, -- Tatsuo Ishii SRA OSS K.K. English: http://www.sraoss.co.jp/index_en/ Japanese:http://www.sraoss.co.jp