Re: Escaping from blocked send() reprised. - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Escaping from blocked send() reprised.
Date
Msg-id 20141009112632.GA29124@awork2.int
Whole thread Raw
In response to Re: Escaping from blocked send() reprised.  (Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>)
Responses Re: Escaping from blocked send() reprised.
List pgsql-hackers
On 2014-10-09 14:06:35 +0900, Kyotaro HORIGUCHI wrote:
> Hello, simplly inhibit set retry flag when ProcDiePending in
> my_sock_write seems enough.
> 
> But it returns with SSL_ERROR_SYSCALL not SSL_ERROR_WANT_WRITE so
> I modified the patch 4 as the attached patch.

Why is that necessary? It seems really rather wrong to make
BIO_set_retry_write() dependant on ProcDiePending? Especially as, at
least in my testing, it's not even required because the be_tls_write()
can just check the error properly?

> diff --git a/src/backend/libpq/be-secure-openssl.c b/src/backend/libpq/be-secure-openssl.c
> index 6fc6903..2288fe2 100644
> --- a/src/backend/libpq/be-secure-openssl.c
> +++ b/src/backend/libpq/be-secure-openssl.c
> @@ -750,7 +750,8 @@ my_sock_write(BIO *h, const char *buf, int size)
>      BIO_clear_retry_flags(h);
>      if (res <= 0)
>      {
> -        if (errno == EINTR || errno == EWOULDBLOCK || errno == EAGAIN)
> +        if (!ProcDiePending &&
> +            (errno == EINTR || errno == EWOULDBLOCK || errno == EAGAIN))
>          {
>              BIO_set_retry_write(h);
>          }


Greetings,

Andres Freund

-- Andres Freund                       http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training &
Services



pgsql-hackers by date:

Previous
From: Alexey Bashtanov
Date:
Subject: Autovacuum fails to keep visibility map up-to-date in mostly-insert-only-tables
Next
From: Robert Haas
Date:
Subject: Re: Deferring some AtStart* allocations?