Re: Re: BUG #8647: Backend process hangs and becomes unkillable when SSL client looses connection - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Re: BUG #8647: Backend process hangs and becomes unkillable when SSL client looses connection
Date
Msg-id 30898.1386264790@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #8647: Backend process hangs and becomes unkillable when SSL client looses connection  (Alexander Kukushkin <cyberdemn@gmail.com>)
List pgsql-bugs
Alexander Kukushkin <cyberdemn@gmail.com> 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

pgsql-bugs by date:

Previous
From: Alexander Kukushkin
Date:
Subject: Re: Re: BUG #8647: Backend process hangs and becomes unkillable when SSL client looses connection
Next
From: vitaly@tskhovrebov.ru
Date:
Subject: BUG #8659: Broken dependencies on RHEL6 for 9.2.6 RPMs