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 1o8Hlx-0004Nx-Qh for pgsql-hackers@arkaria.postgresql.org; Mon, 04 Jul 2022 08:49:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1o8Hlw-0007L7-De for pgsql-hackers@arkaria.postgresql.org; Mon, 04 Jul 2022 08:49:36 +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 1o8Hlw-0007Kw-4d for pgsql-hackers@lists.postgresql.org; Mon, 04 Jul 2022 08:49:36 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o8Hlt-0001o6-A7 for pgsql-hackers@lists.postgresql.org; Mon, 04 Jul 2022 08:49:35 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 5A9BE5C00FB; Mon, 4 Jul 2022 04:49:32 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 04 Jul 2022 04:49:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1656924572; x=1657010972; bh=p P80xLmbTxvCfL01wREa2sTiAtj2itf4Syh2jQyxJdk=; b=wVqVJwDjuIiFGbwqQ MsIv82HP2rswuQKHqYsbZxm7/biDM4JX4X+9Q0rQQbShv7O9w9XD02Kzx+v6Z0BN EfMWlSlEiKSlbu2odzROvWLKQWNzTT/+lbRmD6rkyFNytky/N8D6IppkjhqB0lP2 n8esA6SPcP4z/4SpaYdbtM4RER11Hc8uj0e/0Oy7tpLZhVkqgkCjCN7vy1Oe1550 kQAzqc81vf+mT8xKoLkuTnVK7i4XkW6Lc5ZQsoM5OZHxlIJSoC2a6OnDb6mTJ4c6 G0Lr5udTa0Iui73sCOCloLS695xQDrDwRvS3u8szeHl1CRNtNxVDry/J5Tcnigvs 1fl4g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrudehledgtdekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvvefukfggtggugfgjsehtke ertddttdejnecuhfhrohhmpeetlhhvrghrohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhr vgesrghlvhhhrdhnohdqihhprdhorhhgqeenucggtffrrghtthgvrhhnpedvkedtffduff dtffffheffhfejjefhgfeiueeukeejkeffgfdufffhudffffeuveenucffohhmrghinhep vghnthgvrhhprhhishgvuggsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrg hrrghmpehmrghilhhfrhhomheprghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhr gh X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 4 Jul 2022 04:49:31 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id B428536A; Mon, 4 Jul 2022 10:49:33 +0200 (CEST) Date: Mon, 4 Jul 2022 10:49:33 +0200 From: Alvaro Herrera To: Kyotaro Horiguchi Cc: tgl@sss.pgh.pa.us, daniele.varrazzo@gmail.com, pgsql-hackers@lists.postgresql.org Subject: Re: Using PQexecQuery in pipeline mode produces unexpected Close messages Message-ID: <20220704084933.zi5ejy54ffdm2xlw@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220704.172744.1737300183436118987.horikyota.ntt@gmail.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2022-Jul-04, Kyotaro Horiguchi wrote: > At Wed, 29 Jun 2022 14:09:17 +0200, Alvaro Herrera wrote in > > However, another problem case, not fixed by PIPELINE_IDLE, occurs if you > > exit pipeline mode after PQsendQuery() and then immediately use > > PQexec(). The CloseComplete will be received at the wrong time, and a > > notice is emitted nevertheless. > > Mmm. My patch moves the point of failure of the scenario a bit but > still a little short. However, as my understanding, it seems like the > task of the PQpipelineSync()-PQgetResult() pair to consume the > CloseComplete. If Iinserted PQpipelineSync() just after PQsendQuery() > and called PQgetResult() for PGRES_PIPELINE_SYNC before > PQexitPipelineMode(), the out-of-sync CloseComplete is not seen in the > scenario. But if it is right, I'd like to complain about the > obscure-but-stiff protocol of pipleline mode.. Yeah, if you introduce PQpipelineSync then I think it'll work okay, but my point here was to make it work without requiring that; that's why I wrote the test to use PQsendFlushRequest instead. BTW I patch for the problem with uniqviol also (not fixed by v7). I'll send an updated patch in a little while. > > I produced pipeline_idle.trace file by running the test in the fully > > By the perl script doesn't produce the trace file since the list in > $cmptrace line doesn't contain pipleline_idle.. Ouch, of course, thanks for noticing. -- Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/