Skip site navigation (1) Skip section navigation (2)

Re: 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: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1467: fe_connect doesn't handle EINTR right
Date: 2005-12-08 15:53:02
Message-ID: 200512081553.jB8Fr2K16961@candle.pha.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-hackers
I think this has been corrected in 8.1.

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

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

pgsql-hackers by date

Next:From: Andrew DunstanDate: 2005-12-08 16:04:23
Subject: Re: implement prepared queries in plperl
Previous:From: KaiDate: 2005-12-08 15:36:12
Subject: Re: int to inet conversion [or Re: inet to bigint?]

pgsql-bugs by date

Next:From: Tom LaneDate: 2005-12-08 15:57:32
Subject: Re: BUG #2099: too many private dirs ?
Previous:From: Will SzopkoDate: 2005-12-08 15:39:52
Subject: BUG #2101: Postmaster Crash Using PL/PgSQL With %TYPE on Non-Exisiting Column

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group