Re: [BUGS] BUG #1467: fe_connect doesn't handle EINTR right

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Florian Hars <hars(at)bik-gmbh(dot)de>
Cc: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: [BUGS] BUG #1467: fe_connect doesn't handle EINTR right
Date: 2005-06-25 02:27:49
Message-ID: 200506250227.j5P2Rnr04887@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers


Though we have had no problem reports of this, there is confirmation
that our code is incorrect. Would someone develop a patch to fix this?

Thanks.

---------------------------------------------------------------------------

Florian Hars wrote:
>
> The following bug has been logged online:
>
> Bug reference: 1467
> Logged by: Florian Hars
> Email address: hars(at)bik-gmbh(dot)de
> PostgreSQL version: 8.0.1
> Operating system: All
> Description: fe_connect doesn't handle EINTR right
> Details:
>
> The file pgsql/src/interfaces/libpq/fe-connect.c contains the code fragment
>
> retry_connect:
> if (connect(conn->sock, addr_cur->ai_addr,
> addr_cur->ai_addrlen) < 0)
> {
> if (SOCK_ERRNO == EINTR)
> /* Interrupted system call - just try again */
> goto retry_connect;
> }
>
> This is not in accordance with a strict legalistic reading of the POSIX
> spec, according to which connect is not restartable so that you have to use
> select or poll after connect returned with EINTR.
>
> See
> http://www.eleves.ens.fr:8080/home/madore/computers/connect-intr.html
> for the ugly details, your code should work on Linux, but not on Solaris or
> (Free|Open)BSD.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2005-06-25 04:20:38 Re: [BUGS] BUG #1467: fe_connect doesn't handle EINTR right
Previous Message elein 2005-06-25 01:51:59 Timestamp in log for prepared queries

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2005-06-25 02:32:23 Re: [PATCHES] regexp_replace
Previous Message Bruce Momjian 2005-06-25 02:24:31 Re: Add PG version number to NLS files