Re: Cygwin PostgreSQL Regression Test Problems (Revisited) - Mailing list pgsql-ports

From Jason Tishler
Subject Re: Cygwin PostgreSQL Regression Test Problems (Revisited)
Date
Msg-id 20010330172026.L209@dothill.com
Whole thread Raw
In response to Re: Cygwin PostgreSQL Regression Test Problems (Revisited)  (Jason Tishler <Jason.Tishler@dothill.com>)
Responses RE: Cygwin PostgreSQL Regression Test Problems (Revisited)
List pgsql-ports
Tom,

On Fri, Mar 30, 2001 at 09:25:47AM -0500, Jason Tishler wrote:
> Any feedback on my patch (reattached for convenience)?  I would hate to
> see 7.1 go out the door with this issue.

I believe that I have finally found the root cause to the psql hangs.
IMO, Cygwin is functioning properly and the issue lies in the libpq's
pqWait() use of select().

The MSDN states the following for select():

..
Summary:
    A socket will be identified in a particular set when select returns if:

..

exceptfds:
    If processing a connect call (nonblocking), connection attempt failed.
..

In libpq's pqWait(), we have the following:

    if (select(conn->sock + 1, &input_mask, &output_mask, (fd_set *) NULL,
        (struct timeval *) NULL) < 0)

After reading the above code, I hypothesized that select() was hanging
because the exceptfds was NULL.

Sure enough, if I apply the attached (nasty, hacky) patch, then the
regression test does *not* hang anymore -- even with nonblocking connects.
Although some tests will fail due to a connection refused condition --
which is not unreasonable since postmaster is very busy.

IMO, pqWait() should be enhanced to check the exceptfds too -- at least
for Cygwin.  If it is not too late in the release cycle to consider such
a change, then someone with much more intimate knowledge of libpq should
only use my patch as a starting point and then do the right thing.

If the above enhancement is deemed too risky, then I implore the
PostgreSQL team to accept my previous patch that just makes connects
blocking for Cygwin.  Note with this patch applied, I did see some
regression test failures due to a connection refused condition -- for
the same reasons as above.

Thanks,
Jason

--
Jason Tishler
Director, Software Engineering       Phone: +1 (732) 264-8770 x235
Dot Hill Systems Corp.               Fax:   +1 (732) 264-8798
82 Bethany Road, Suite 7             Email: Jason.Tishler@dothill.com
Hazlet, NJ 07730 USA                 WWW:   http://www.dothill.com

Attachment

pgsql-ports by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Compiling PostgreSQL 7.x on BeOS R5?
Next
From: "Hiroshi Inoue"
Date:
Subject: RE: Cygwin PostgreSQL Regression Test Problems (Revisited)