Re: [HACKERS] Re: SIGPIPE gripe

Поиск
Список
Период
Сортировка
От Peter T Mount
Тема Re: [HACKERS] Re: SIGPIPE gripe
Дата
Msg-id Pine.LNX.3.95.980504204642.27875A-100000@retep.org.uk
обсуждение исходный текст
Ответ на Re: SIGPIPE gripe  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Mon, 4 May 1998, Tom Lane wrote:

[snip]

> Meanwhile, once the client receives the "AUTH OK" it initiates
> an empty query cycle (which is commented as intending to discover
> whether the database exists!):
>
>     ...
>
>     Client receives "AUTH_OK"
>
>     Client sends "Q " query
>
>     Client waits for response
>
> The problem, of course, is that if the backend manages to exit
> before the client gets to send its empty query, then the client
> is writing on a closed connection.  Boom, SIGPIPE.

[snip]

> So ... since we're altering the protocol anyway ... the right fix is
> to alter the protocol a little more.  Remember that "Z" message that
> the backend is now sending at the end of every query cycle?  What
> we ought to do is make the BE send "Z" at completion of startup,
> as well.  (In other words, "Z" will really mean "Ready for Query"
> rather than "Query Done".  This is actually easier to implement in
> postgres.c than the other way.)  Now the client's startup procedure
> looks like
>
>     ...
>
>     Client receives "AUTH_OK"
>
>     Client waits for "Z" ; if get "E" instead, BE startup failed.

This sounds fair enough. Infact we could then throw a more meaningful
error message when this occurs.

> I suspect it's not really necessary to do an empty query after this,
> but we may as well leave that in there for additional reliability.

In JDBC, I replaced (back in 6.2) the empty query with one to get the
current DateStyle (which the driver then uses to handle dates correctly).

--
Peter T Mount peter@retep.org.uk or petermount@earthling.net
Main Homepage: http://www.retep.org.uk
************ Someday I may rebuild this signature completely ;-) ************
Work Homepage: http://www.maidstone.gov.uk Work EMail: peter@maidstone.gov.uk


В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Jackson, DeJuan"
Дата:
Сообщение: RE: [QUESTIONS] Best way to halt an unending query.
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] Postgresql6.3.2 libdld and the twilight zone.