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 1ka2p1-0005h7-Uz for pgsql-hackers@arkaria.postgresql.org; Tue, 03 Nov 2020 20:22:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ka2p0-0006K0-HV for pgsql-hackers@arkaria.postgresql.org; Tue, 03 Nov 2020 20:22:26 +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 1kZxvm-0002HY-AH for pgsql-hackers@lists.postgresql.org; Tue, 03 Nov 2020 15:09:06 +0000 Received: from forwardcorp1p.mail.yandex.net ([2a02:6b8:0:1472:2741:0:8b6:217]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kZxvi-0004O5-6O for pgsql-hackers@lists.postgresql.org; Tue, 03 Nov 2020 15:09:05 +0000 Received: from sas1-5717c3cea310.qloud-c.yandex.net (sas1-5717c3cea310.qloud-c.yandex.net [IPv6:2a02:6b8:c14:3616:0:640:5717:c3ce]) by forwardcorp1p.mail.yandex.net (Yandex) with ESMTP id 1A5992E14F1; Tue, 3 Nov 2020 18:08:57 +0300 (MSK) Received: from localhost (localhost [::1]) by sas1-5717c3cea310.qloud-c.yandex.net (mxbackcorp/Yandex) with ESMTP id eFduUdplXH-8uwekJwv; Tue, 03 Nov 2020 18:08:57 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1604416137; bh=u1nsvuJ/5F53PK2vlJif+JWklI8VhvdEh/MQo06lk64=; h=Cc:Subject:Date:References:To:From:Message-Id; b=OlKUcVLSPnns2bWzeEJC8M7V43yds/Os972OFyJsy4RpBxOt7H0inG2y7+Aedr7dx f0HjxEeNBBTmrqfFePaWygIbz+AqDxNinxl1lIt1ERagfx/6nX4N3Nw3SayI/5hBSk JVGf9Wwk3gsDBJTsOUeAsJsCUjzg0r0mq/EuoaCE= Authentication-Results: sas1-5717c3cea310.qloud-c.yandex.net; dkim=pass header.i=@yandex-team.ru X-Yandex-Sender-Uid: 1120000000271597 X-Yandex-Avir: 1 Received: from iva8-d077482f1536.qloud-c.yandex.net (iva8-d077482f1536.qloud-c.yandex.net [2a02:6b8:c0c:2f26:0:640:d077:482f]) by iva8-00026c0e2ab1.qloud-c.yandex.net with LMTP id ImmgnPEz3I-NF3CKB8M for ; Tue, 03 Nov 2020 18:08:45 +0300 Received: by iva8-edafde7c849c.qloud-c.yandex.net with HTTP; Tue, 03 Nov 2020 18:08:45 +0300 From: Daniil Zakhlystov To: Konstantin Knizhnik Cc: PostgreSQL Hackers , Andres Freund , Andrey Borodin References: <74F0A385-6ED4-4EA7-9498-1A8527F16472@yandex-team.ru> <22446ba0-058d-624a-a679-edc0215a56c8@postgrespro.ru> <20201028192712.xj2qneyb3fvmjm6c@alap3.anarazel.de> <3b1d2752-b7b5-db39-84c9-4ff024041fff@postgrespro.ru> <20201030210308.54jjmnvhspk6p7cb@alap3.anarazel.de> <059E5FF6-96A6-4DCE-83DE-8B20ECBFB843@yandex-team.ru> <20201102195059.w6qnplbyargqwbp2@alap3.anarazel.de> Subject: Re: libpq compression MIME-Version: 1.0 X-Mailer: Yamail [ http://yandex.ru ] 5.0 Date: Tue, 03 Nov 2020 20:08:55 +0500 Message-Id: <359061604415173@mail.yandex-team.ru> Content-Transfer-Encoding: 7bit Content-Type: text/html List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk
Hi,

Looks like I found an issue: there can be a situation when libpq frontend hangs after zpq_read(). This may happen when the socket is not read ready and we can't perform another read because we wait on pqWait() but we actually have some buffered rx data.

I think we should add a check if there is any buffered rx data before calling pqWait() to avoid such hangs.

--
Daniil Zakhlystov