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 1r6Sqf-000yzD-6D for pgsql-bugs@arkaria.postgresql.org; Fri, 24 Nov 2023 09:51:45 +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 1r6Sqd-009QXN-Tx for pgsql-bugs@arkaria.postgresql.org; Fri, 24 Nov 2023 09:51:43 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r6Spc-009NRT-RX for pgsql-bugs@lists.postgresql.org; Fri, 24 Nov 2023 09:50:42 +0000 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r6SpY-0077WY-Sw for pgsql-bugs@lists.postgresql.org; Fri, 24 Nov 2023 09:50:39 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 2C15D3200A11; Fri, 24 Nov 2023 04:50:34 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Fri, 24 Nov 2023 04:50:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type: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=fm1; t=1700819433; x= 1700905833; bh=bcYBPjVaqIlS1VbqdRseIByvjHDzcDHiq42+17YIgwA=; b=u MNjkS5QmRuEKUc3JdrOAOAXFV+h2VYPtLvVxNj/Ha5YEC1OePZz6IK+e4J3kr1z5 lY4cREtk9S2aX4Al0X7WQPlg/jrbAe5sHSsnmQ6iPJi94c3WeOczfMICcnNAuN1G 2ySl3k6G932SyiKYIYSesPBarn4Q2unPHuc52YOBhnRcgv8UMRiUdMV3u9vD9ilX OMJlilidTsTfS7FZE17+498XO94r54jLYP49u4mdaDtMZZjNUy75p1QfB6hP+hAH 7lqfelD9vDirC0f8i8oCbhJez+l5SLkD1IhSIvnB6x2VSq4kSaK7gBmNegLUDUwx l5Ll2FKk3yhhgBD9kVOnw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudehhedgtdejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkgggtugfgjgesthekredttddtjeenucfhrhhomheptehlvhgr rhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh eqnecuggftrfgrthhtvghrnhepkeefieehkeekffdtffeggedtffelkeeigfduvdekgfdu gfeluedtiefhkeetudfgnecuffhomhgrihhnpehgihhthhhusgdrtghomhdpvghnthgvrh hprhhishgvuggsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehm rghilhhfrhhomheprghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 24 Nov 2023 04:50:33 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1700819430; bh=aB6Lu23Dbad4hhM1mN6+IOJ/bordMEJrl9HQAv0SVJo=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=WTTd39lNIFshDJT6TGJEbbWh7nEeoDiMgjEmJ8UhtJj+ScGm+zZYCHzwVfOeSvJgX smcCUIpUfzicXKfGLRGmw+SQllgYzoXjPsQXY8EpFLOtAsj/sN5rvGq/oDrgas1vt7 FkmncjTKHXMeZJbOkVRsv9L7InFO8nVx8ctQ1wwrTQKxdHNbJgxiCJX8i2joSPV3Ly BS1my/JuFysqB0GkE89d3vVCfRsieqPFAZis1SAphFVowMgniUlEHv6xQCXRLb1bbd sW4wzIPElLQJIoyw9CdX60ZTwy24h+raM0FgsPWvckdZGTykTD45Zz/9r7dIQuuyyy hS0mHho58g5fQ== Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 75486DB; Fri, 24 Nov 2023 10:50:30 +0100 (CET) Date: Fri, 24 Nov 2023 10:50:30 +0100 From: Alvaro Herrera To: Michael Paquier Cc: Ivan Trofimov , pgsql-bugs@lists.postgresql.org Subject: Re: libpq: pipeline mode might desynchronize client and server Message-ID: <202311240950.qmsmomjrr76f@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2023-Nov-24, Michael Paquier wrote: > On Wed, Nov 22, 2023 at 03:13:46AM +0300, Ivan Trofimov wrote: > > Libpq in pipeline mode considers '< 2TDCEZ' a sufficient response to > > '> BDESS', when according to specification one more 'Z' is expected. > > This leads to client <-> server desynchronization, when libpq parses the > > very next message server sends (which is Z, as expected). > > > > A bit more context and a MRE: > > https://github.com/itrofimow/libpq_protocol_desync > > > > I'm pretty sure that this branch https://github.com/postgres/postgres/blob/3af101ce8be8eeb0e8adc61e293b5d12989f68be/src/interfaces/libpq/fe-exec.c#L2124 > > should be adjusted to handle the case and do not match error response > > against sync query. > > Could you attach the test case to the original thread please (assuming > that this is the same problem)? If this data is deleted by github, > then any data making a problem reproducible would be lost. FWIW I started looking at this problem a couple of days ago. I had not noticed the previous thread. -- Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/ "El hombre nunca sabe de lo que es capaz hasta que lo intenta" (C. Dickens)