Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Vocng-0007zN-4b for pgsql-bugs@arkaria.postgresql.org; Thu, 05 Dec 2013 17:33:20 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Vocne-0004OA-Vd for pgsql-bugs@arkaria.postgresql.org; Thu, 05 Dec 2013 17:33:19 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Vocne-0004O0-6d for pgsql-bugs@postgresql.org; Thu, 05 Dec 2013 17:33:18 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VocnX-00021Z-Q1 for pgsql-bugs@postgresql.org; Thu, 05 Dec 2013 17:33:17 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id rB5HXAm8030899; Thu, 5 Dec 2013 12:33:10 -0500 From: Tom Lane To: Alexander Kukushkin cc: pgsql-bugs@postgresql.org Subject: Re: Re: BUG #8647: Backend process hangs and becomes unkillable when SSL client looses connection In-reply-to: References: Comments: In-reply-to Alexander Kukushkin message dated "Thu, 05 Dec 2013 12:32:02 +0100" Date: Thu, 05 Dec 2013 12:33:10 -0500 Message-ID: <30898.1386264790@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Alexander Kukushkin writes: > For me fix of this issue should look like following: > ---------------------------------------------------------------------------------------------------------------------------- > static int > my_sock_write(BIO *h, const char *buf, int size) > { > int res = 0; > res = send(h->num, buf, size, 0); > + BIO_clear_retry_flags(b); > if (res <= 0) > { > if (errno == EINTR) > { > BIO_set_retry_write(h); > } > } > return res; > } I looked into the source code of current openssl (1.0.1e) and confirmed that there's a BIO_clear_retry_flags step in the code that we're copying (sock_write in crypto/bio/bss_sock.c). Possibly we screwed up when we made that copy, but my money is on the theory that this is a bug fix that appeared in upstream openssl sometime after we cloned the function. (There is a BIO_clear_retry_flag step in sock_read, both our version and theirs.) Anyway, it seems clear that we want to adopt this change, particularly now that you've demonstrated a user-visible bug from not resetting the flags here. Will commit, thanks for the report! regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs