Re: Cygwin PostgreSQL Regression Test Problems (Revisited)

From: Jason Tishler <Jason(dot)Tishler(at)dothill(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-ports(at)postgresql(dot)org
Subject: Re: Cygwin PostgreSQL Regression Test Problems (Revisited)
Date: 2001-03-30 22:20:26
Message-ID: 20010330172026.L209@dothill.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)Tishler(at)dothill(dot)com
Hazlet, NJ 07730 USA WWW: http://www.dothill.com

Attachment Content-Type Size
fe-misc.c.patch text/plain 1.1 KB

In response to

Responses

Browse pgsql-ports by date

  From Date Subject
Next Message Hiroshi Inoue 2001-03-31 01:15:08 RE: Cygwin PostgreSQL Regression Test Problems (Revisited)
Previous Message Fred Yankowski 2001-03-30 18:09:36 patch for minor Win32 makefile bug