From: Joe Murphy <joe.murphy@aersoft.ie>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Joe Murphy <joe.murphy@aersoft.ie>
Cc: pgsql-interfaces@postgresql.org <pgsql-interfaces@postgresql.org>
Subject: Re: libpq, threads and connection reset
Date: Fri, 06 Sep 2002 11:31:47 +0100
Message-ID: <3D788412.CCFB57E2@aersoft.com> (raw)
References: <20020828025202.C74E81D1943C8@bjapp2.163.net>
<3D7751B5.CE431206@aersoft.com>
<3D775423.78A43764@aersoft.com>
<29109.1031235564@sss.pgh.pa.us>
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
The problem I was having "went away" when I moved to another Solaris 2.6
machine with the latest patch level.
<br>I've also tested it on Solaris 8, HP-UX 11.00 and Linux, so it looks
like there is a connect bug in a release 2.6,
<br>but seems to be fixed with later patches.
<p>Thanks for the help.
<p>Joe
<p>Tom Lane wrote:
<blockquote TYPE=CITE>Joe Murphy <joe.murphy@aersoft.ie> writes:
<br>>> The re-connect underlying call to connect returns -1 and errno =
0, so
<br>>> it thinks the connection is "in progress" and tries
<br>>> to complete the connection - but hangs on the select (poll)
<p>Well, you have a bug in connect() if it's returning the wrong errno
<br>in the multi-thread case.
<p>However, our code in fe-connect.c reads like this:
<p> if (connect(conn->sock, &conn->raddr.sa, conn->raddr_len)
< 0)
<br> {
<br> if (SOCK_ERRNO == EINTR)
<br>
/* Interrupted system call - we'll just try again */
<br>
goto retry1;
<p> if (SOCK_ERRNO == EINPROGRESS
|| SOCK_ERRNO == EWOULDBLOCK || SOCK_ERRNO == 0)
<br> {
<br>
/*
<br>
* This is fine - we're in non-blocking mode, and the
<br>
* connection is in progress.
<br>
*/
<br>
conn->status = CONNECTION_STARTED;
<br> }
<br> else
<br> {
<br>
/* Something's gone wrong */
<br>
connectFailureMessage(conn, SOCK_ERRNO);
<br>
goto connect_errReturn;
<br> }
<p>I wonder whether it's really a good idea to treat errno == 0 as
<br>indicating "connection in progress". Does anyone know of a platform
<br>where zero is actually what is returned in this case? The man
pages
<br>I can find all say that EINPROGRESS is returned.
<p>
regards, tom lane
<p>---------------------------(end of broadcast)---------------------------
<br>TIP 4: Don't 'kill -9' the postmaster</blockquote>
<pre>--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Joe Murphy - AerSoft Limited
2 Northumberland Avenue, Dun Laoghaire, Co. Dublin.
phone: +353-1-2301166 direct: +353-1-2145953 fax: +353-1-2301167
<A HREF="mailto:joe@aersoft.com">mailto:joe@aersoft.com</A> mobile: +353-86-8526181 <A HREF="http://www.aersoft.com">http://www.aersoft.com</A>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</pre>
</html>
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 using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: joe.murphy@aersoft.ie, tgl@sss.pgh.pa.us
Subject: Re: libpq, threads and connection reset
In-Reply-To: <3D788412.CCFB57E2@aersoft.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