Re: Re: BUG #8647: Backend process hangs and becomes unkillable when SSL client looses connection

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alexander Kukushkin <cyberdemn(at)gmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Re: BUG #8647: Backend process hangs and becomes unkillable when SSL client looses connection
Date: 2013-12-05 17:33:10
Message-ID: 30898.1386264790@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Alexander Kukushkin <cyberdemn(at)gmail(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message vitaly 2013-12-05 18:02:19 BUG #8659: Broken dependencies on RHEL6 for 9.2.6 RPMs
Previous Message Alexander Kukushkin 2013-12-05 16:07:55 Re: Re: BUG #8647: Backend process hangs and becomes unkillable when SSL client looses connection