Thread: Re: UNIX domain socket change breaks PostgreSQL (was Re: initdb fails)

Re: UNIX domain socket change breaks PostgreSQL (was Re: initdb fails)

From
Christopher Faylor
Date:
Which part of the patch caused the problem?

cgf

On Wed, Apr 18, 2001 at 04:45:18PM -0400, Jason Tishler wrote:
>Chris,
>
>The following recent change:
>
>    http://www.cygwin.com/ml/cygwin-cvs/2001-q2/msg00032.html
>
>breaks UNIX domain socket access between PostgreSQL clients and servers.
>
>See the attached for details.
>
>I'm not very knowledgeable with sockets so I don't know if this is a
>Cygwin or PostgreSQL problem.  Any suggestions would be greatly
>appreciated.
>
>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

>From: Jason Tishler <Jason.Tishler@dothill.com>
>To: schopen@dimdi.de
>Cc: pgsql-cygwin@postgresql.org
>Subject: Re: [CYGWIN] initdb fails
>Date: Wed, 18 Apr 2001 15:38:38 -0400
>Mail-Followup-To: schopen@dimdi.de, pgsql-cygwin@postgresql.org
>In-Reply-To: <20010418133004.F536@dothill.com>; from Jason.Tishler@dothill.com on Wed, Apr 18, 2001 at 01:30:04PM
-0400
>Organization: Dot Hill Systems Corp.
>
>Michael,
>
>On Wed, Apr 18, 2001 at 01:30:04PM -0400, Jason Tishler wrote:
>> On Wed, Apr 18, 2001 at 06:13:43PM +0200, schopen@dimdi.de wrote:
>> > bash-2.04$ bin/initdb
>> > This database system will be initialized with username "schopen".
>> > This user will own all the data files and must also own the server
>> > process.
>> >
>> > Creating directory /usr/share/postgresql/data
>> > [snip]
>> > Initializing pg_shadow.
>> >
>> > initdb failed.
>> > Removing /usr/share/postgresql/data.
>> > Removing temp file /tmp/initdb.194.
>> >
>> > Any help? Thanks a lot.
>>
>> I just tried the above with the following configuration:
>>
>>     NT 4.0 SP6a
>>     PostgreSQL 7.1-2
>>     cygipc 1.09-2
>>     Cygwin 1.1.8-2 (with cygwin1.dll replaced by cygwin1-20010416.dll.bz2)
>>
>> and the initdb worked as expected.
>
>The plot thickens or I spoke too soon.
>
>Although initdb works, I am getting the following errors when I connect
>to postmaster:
>
>    # server side
>    $ postmaster
>    DEBUG:  database system was shut down at 2001-04-18 15:12:29
>    DEBUG:  CheckPoint record at (0, 1563376)
>    DEBUG:  Redo record at (0, 1563376); Undo record at (0, 0); Shutdown TRUE
>    DEBUG:  NextTransactionId: 619; NextOid: 18720
>    DEBUG:  database system is in production state
>    pq_flush: send() failed: The connection was aborted
>    pq_recvbuf: recv() failed: errno ESHUTDOWN triggered
>
>    # client side
>    $ psql -l
>    psql: pqReadData() -- backend closed the channel unexpectedly.
>            This probably means the backend terminated abnormally
>            before or while processing the request.
>
>The Cygwin snapshot from 4/13/2001 works but the one from 4/14/2001
>doesn't.  I'm trying to determine why.  I will report back when I get
>more information.
>
>If anyone wants to help, please jump in.
>
>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
>
>---------------------------(end of broadcast)---------------------------
>TIP 6: Have you searched our list archives?
>
>http://www.postgresql.org/search.mpl
>


--
cgf@cygnus.com                        Red Hat, Inc.
http://sources.redhat.com/            http://www.redhat.com/

Re: UNIX domain socket change breaks PostgreSQL (was Re: initdb fails)

From
Jason Tishler
Date:
Chris,

On Wed, Apr 18, 2001 at 04:48:28PM -0400, Christopher Faylor wrote:
> Which part of the patch caused the problem?

If I only back out the select part:

    http://sources.redhat.com/cgi-bin/cvsweb.cgi/winsup/cygwin/select.cc.diff?cvsroot=uberbaum&r1=1.35&r2=1.36

then PostgreSQL is happy again.

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

Re: UNIX domain socket change breaks PostgreSQL (was Re: initdb fails)

From
Christopher Faylor
Date:
On Wed, Apr 18, 2001 at 04:58:09PM -0400, Jason Tishler wrote:
>On Wed, Apr 18, 2001 at 04:48:28PM -0400, Christopher Faylor wrote:
>>Which part of the patch caused the problem?
>
>If I only back out the select part:
>
>http://sources.redhat.com/cgi-bin/cvsweb.cgi/winsup/cygwin/select.cc.diff?cvsroot=uberbaum&r1=1.35&r2=1.36
>
>then PostgreSQL is happy again.

I can't imagine how that could be.  That is a dummy socket.  It should
have no effect on anything but cygwin.

I could believe that the change to AF_UNIX sockets would have an effect,
though.  I've backed out that patch since it was ill-advised.

Could you try putting back the select change and backing out the net.cc
change?  I would be interested in seeing if that fixes things too.

cgf

Re: UNIX domain socket change breaks PostgreSQL (was Re: initdb fails)

From
Jason Tishler
Date:
Chris,

On Wed, Apr 18, 2001 at 05:24:43PM -0400, Christopher Faylor wrote:
> On Wed, Apr 18, 2001 at 04:58:09PM -0400, Jason Tishler wrote:
> >On Wed, Apr 18, 2001 at 04:48:28PM -0400, Christopher Faylor wrote:
> >>Which part of the patch caused the problem?
> >
> >If I only back out the select part:
> >
> >http://sources.redhat.com/cgi-bin/cvsweb.cgi/winsup/cygwin/select.cc.diff?cvsroot=uberbaum&r1=1.35&r2=1.36
> >
> >then PostgreSQL is happy again.
>
> I can't imagine how that could be.  That is a dummy socket.  It should
> have no effect on anything but cygwin.

By "cygwin" do you mean the DLL or any Cygwin process?  I wasn't explicit
but both postmaster and psql are Cygwin processes.

> I could believe that the change to AF_UNIX sockets would have an effect,
> though.  I've backed out that patch since it was ill-advised.

I will do a full cvs update, make clean, and make to verify that the
problem is fixed in the current CVS.  I'll report back tomorrow.

> Could you try putting back the select change and backing out the net.cc
> change?  I would be interested in seeing if that fixes things too.

This fixes the problem too which implies that it should be fixed in the
current CVS.

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

Re: UNIX domain socket change breaks PostgreSQL (was Re: initdb fails)

From
Christopher Faylor
Date:
On Wed, Apr 18, 2001 at 05:53:18PM -0400, Jason Tishler wrote:
>Chris,
>
>On Wed, Apr 18, 2001 at 05:24:43PM -0400, Christopher Faylor wrote:
>> On Wed, Apr 18, 2001 at 04:58:09PM -0400, Jason Tishler wrote:
>> >On Wed, Apr 18, 2001 at 04:48:28PM -0400, Christopher Faylor wrote:
>> >>Which part of the patch caused the problem?
>> >
>> >If I only back out the select part:
>> >
>> >http://sources.redhat.com/cgi-bin/cvsweb.cgi/winsup/cygwin/select.cc.diff?cvsroot=uberbaum&r1=1.35&r2=1.36
>> >
>> >then PostgreSQL is happy again.
>>
>> I can't imagine how that could be.  That is a dummy socket.  It should
>> have no effect on anything but cygwin.
>
>By "cygwin" do you mean the DLL or any Cygwin process?  I wasn't explicit
>but both postmaster and psql are Cygwin processes.

I meant "internal to cygwin".  The SO_LINGER change only affects a socket
that is used by cygwin.  I think it is possible that reverting that change
might have slowed down select enough that it made things appear to work,
though.

>> I could believe that the change to AF_UNIX sockets would have an effect,
>> though.  I've backed out that patch since it was ill-advised.
>
>I will do a full cvs update, make clean, and make to verify that the
>problem is fixed in the current CVS.  I'll report back tomorrow.

Ok.  I would be interested in seeing if all of the changes that I made
affect PostgresSQL.

>> Could you try putting back the select change and backing out the net.cc
>> change?  I would be interested in seeing if that fixes things too.
>
>This fixes the problem too which implies that it should be fixed in the
>current CVS.

Good.  That makes sense.  I should have read the description of SO_LINGER
before I made the change for AF_UNIX sockets.  If I had, I never would have
considered it.

cgf

Re: UNIX domain socket change breaks PostgreSQL (was Re: initdb fails)

From
Jason Tishler
Date:
Chris,

On Wed, Apr 18, 2001 at 06:19:08PM -0400, Christopher Faylor wrote:
> On Wed, Apr 18, 2001 at 05:53:18PM -0400, Jason Tishler wrote:
> >I will do a full cvs update, make clean, and make to verify that the
> >problem is fixed in the current CVS.  I'll report back tomorrow.
>
> Ok.  I would be interested in seeing if all of the changes that I made
> affect PostgresSQL.

The problem is fixed in the current CVS too.  I just ran a full PostgreSQL
regression test and all tests passed.  Note that I just ran against the
DLL -- I didn't rebuild PostgreSQL against the snapshot.

> >> Could you try putting back the select change and backing out the net.cc
> >> change?  I would be interested in seeing if that fixes things too.
> >
> >This fixes the problem too which implies that it should be fixed in the
> >current CVS.
>
> Good.  That makes sense.  I should have read the description of SO_LINGER
> before I made the change for AF_UNIX sockets.  If I had, I never would have
> considered it.

No problem.  Thanks for the speedy fix -- it is much appreciated.

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