Re: Startup messages for socket protocol - Mailing list pgsql-general

From Guillaume Yziquel
Subject Re: Startup messages for socket protocol
Date
Msg-id 20110317150854.GY22969@localhost
Whole thread Raw
In response to Re: Startup messages for socket protocol  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Startup messages for socket protocol  (Guillaume Yziquel <guillaume.yziquel@citycable.ch>)
List pgsql-general
Le Thursday 17 Mar 2011 à 10:48:50 (-0400), Tom Lane a écrit :
> Guillaume Yziquel <guillaume.yziquel@citycable.ch> writes:
> > However, when I try to send this as the first thing, I get disconnected
> > by the server. Reading what the psql program does, I first get an 8 byte
> > message containing this:
>
> >             \000\000\000\008\004\210\022/
>
> > This seems to work, but I'm at a loss pinpointing in the libpq source
> > code where that would fit in the protocol.
>
> [ scratches head... ]  You should be getting either an ErrorResponse
> message or some AuthenticationXXX variant, and both of those would start
> with an ASCII character ('E' or 'R').

For now, when sending \000\003\000\000 and only this, the server seems
to disconnect. The recv() call on the socket returns 0, which should
mean that the server has dropped the connection.

> I'm not sure what the above could
> be, unless maybe you're somehow triggering an SSL startup handshake ---

For now, I simply have a INET socket. Just sending \000\003\000\000. No
SSL handshake.

> but the first returned byte should be an 'S' in that case.  Are you sure
> you've correctly identified what is payload data, versus what's TCP
> overhead or something like that?

Not sure how to identify that. What I identified was 'cannot read and
server disconnects client'. When I send \000\000\000\008\004\210\022/
(which is what the psql sent me when I looked it up), I get a "N", and
it waits for further data (i.e. not disconnected yet...). Then I get
disconnected after some timeout, I guess.

> It might also be enlightening to look into the server's log, especially
> if you were to crank log_min_messages way up so it logs debug stuff.

Not so familiar as to where to look, except for the file in
/var/log/postgresql:

2011-03-17 14:41:34 CET LOG:  longueur invalide du paquet de d?marrage
2011-03-17 14:42:12 CET LOG:  longueur invalide du paquet de d?marrage
2011-03-17 14:42:21 CET LOG:  longueur invalide du paquet de d?marrage
2011-03-17 14:43:46 CET LOG:  longueur invalide du paquet de d?marrage
2011-03-17 14:45:01 CET LOG:  longueur invalide du paquet de d?marrage
2011-03-17 14:46:38 CET LOG:  longueur invalide du paquet de d?marrage
2011-03-17 15:08:04 CET LOG:  longueur invalide du paquet de d?marrage
2011-03-17 15:33:08 CET LOG:  longueur invalide du paquet de d?marrage
2011-03-17 15:35:36 CET LOG:  longueur invalide du paquet de d?marrage
2011-03-17 16:01:16 CET LOG:  longueur invalide du paquet de d?marrage

In english: invalid length for startup packet.

>             regards, tom lane

What should a typical startup packet be? psql confuses me more than it
helps me.

--
     Guillaume Yziquel

pgsql-general by date:

Previous
From: "Gauthier, Dave"
Date:
Subject: Re: Getting users/privs for tables.
Next
From: bkwiencien
Date:
Subject: pgwatch by Cybertec