pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ryan Kelly <rpkelly22@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Bruce Momjian <bruce@momjian.us>
Cc: pgsql-bugs@postgresql.org
Subject: Re: [PATCH] Prevent hanging on unreachable hosts on startup
Date: Tue, 28 Aug 2012 07:40:07 -0400
Message-ID: <20120828114007.GA31047@llserver.lakeliving.com> (raw)
In-Reply-To: <14892.1346117688@sss.pgh.pa.us>
References: <20120105011730.GA26760@llserver.lakeliving.com>
	<3741.1325731017@sss.pgh.pa.us>
	<20120105142355.GB26760@llserver.lakeliving.com>
	<20120827032741.GE28780@momjian.us>
	<14892.1346117688@sss.pgh.pa.us>

On Mon, Aug 27, 2012 at 09:34:48PM -0400, Tom Lane wrote:
> Bruce Momjian <bruce@momjian.us> writes:
> > Tom, can you comment on this patch because you commented on the previous
> > version?  Thanks.
> 
> Doesn't that provoke a pile of compiler warnings about local variables
> potentially being altered during longjmp?  It sure looks pretty unsafe
> from here.  It also fails to print any error message if a connection
> attempt is canceled.
> 
> A bigger-picture question is just how safe it is to longjmp out of libpq
> partway through a connection attempt.  At the very least, that's likely
> to leak an open socket and some memory.  Maybe that doesn't matter too
> much for psql, but I'm not convinced.  It seems fairly likely that
> internal state for libc (malloc), openssl, etc, could be left in a
> corrupt state if the interrupt happens at just the wrong time.  (This
> didn't matter so much for the original proposal, where we'd just have
> been exiting psql anyway on failure.  But if it's in \c then we want
> psql to still be operational after a failure.)
> 
> We could perhaps dodge the longjmp safety question by using a
> PQconnectStartParams/PQconnectPoll loop.  I'm not sure that provides
> 100% the same functionality --- in particular, I think it wouldn't allow
> interrupting out of a DNS name resolution delay.  But it'd be less
> likely to result in strange crashes.
> 
> 			regards, tom lane

The latest on this patch can be found here:
http://archives.postgresql.org/message-id/500151C4.5010509@enterprisedb.com

-Ryan Kelly




view thread (6+ messages)

Message-ID: <20120828114007.GA31047@llserver.lakeliving.com>
Permalink:  ../20120828114007.GA31047@llserver.lakeliving.com/
Also on:    postgresql.org/message-id/20120828114007.GA31047@llserver.lakeliving.com

 · 

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: rpkelly22@gmail.com, tgl@sss.pgh.pa.us, bruce@momjian.us
  Subject: Re: [PATCH] Prevent hanging on unreachable hosts on startup
  In-Reply-To: <20120828114007.GA31047@llserver.lakeliving.com>
  References: <20120105011730.GA26760@llserver.lakeliving.com> <3741.1325731017@sss.pgh.pa.us> <20120105142355.GB26760@llserver.lakeliving.com> <20120827032741.GE28780@momjian.us> <14892.1346117688@sss.pgh.pa.us> <20120828114007.GA31047@llserver.lakeliving.com>

* 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