Unix Technical Forum

BUG #1467: fe_connect doesn't handle EINTR right

This is a discussion on BUG #1467: fe_connect doesn't handle EINTR right within the pgsql Bugs forums, part of the PostgreSQL category; --> The following bug has been logged online: Bug reference: 1467 Logged by: Florian Hars Email address: hars@bik-gmbh.de PostgreSQL version: ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Bugs

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-10-2008, 08:32 AM
Florian Hars
 
Posts: n/a
Default BUG #1467: fe_connect doesn't handle EINTR right


The following bug has been logged online:

Bug reference: 1467
Logged by: Florian Hars
Email address: hars@bik-gmbh.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/m...nect-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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-10-2008, 09:33 AM
Bruce Momjian
 
Posts: n/a
Default Re: BUG #1467: fe_connect doesn't handle EINTR right


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@bik-gmbh.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/m...nect-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@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 09:24 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com