pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alexander Kukushkin <cyberdemn@gmail.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: Re: BUG #8647: Backend process hangs and becomes unkillable when SSL client looses connection
Date: Thu, 05 Dec 2013 12:33:10 -0500
Message-ID: <30898.1386264790@sss.pgh.pa.us> (raw)
In-Reply-To: <CAFh8B=n84eWSmvau3ETL0OMUfrHag9Rotmc2AzizqaZBpQsLZg@mail.gmail.com>
References: <CAFh8B=n84eWSmvau3ETL0OMUfrHag9Rotmc2AzizqaZBpQsLZg@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (6+ messages)

Message-ID: <30898.1386264790@sss.pgh.pa.us>
Permalink:  ../30898.1386264790@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/30898.1386264790@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, cyberdemn@gmail.com
  Subject: Re: BUG #8647: Backend process hangs and becomes unkillable when SSL client looses connection
  In-Reply-To: <30898.1386264790@sss.pgh.pa.us>
  References: <CAFh8B=n84eWSmvau3ETL0OMUfrHag9Rotmc2AzizqaZBpQsLZg@mail.gmail.com> <30898.1386264790@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox