Re: [JDBC] Missing documentation for error code: 80S01

Lists: pgsql-adminpgsql-bugspgsql-jdbc
From: "Donald Fraser" <postgres(at)kiwi-fraser(dot)net>
To: "[ADMIN]" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Missing documentation for error code: 80S01
Date: 2011-04-12 12:48:52
Message-ID: 00C88DF265FC483EBE2322C834A76698@DEVELOP1
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin pgsql-bugs pgsql-jdbc

Correction error code should be:
08S01
and NOT
80S01

----- Original Message -----
Subject: Missing documentation for error code: 80S01

PostgreSQL version 8.3.14

There appears to be no documentation on the following error code:
Error code is: 80S01
Message: "The backend has broken the connection. Possibly the action you have attempted has caused it to close."

I was expecting the code to be something like: crash_shutdown, however that appears to be under a
completely different error class: 57P02.
Regards
Donald


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Donald Fraser" <postgres(at)kiwi-fraser(dot)net>
Cc: "[ADMIN]" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Missing documentation for error code: 80S01
Date: 2011-04-12 14:52:55
Message-ID: 9956.1302619975@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin pgsql-bugs pgsql-jdbc

"Donald Fraser" <postgres(at)kiwi-fraser(dot)net> writes:
> Correction error code should be:
> 08S01
> and NOT
> 80S01

The reason it's not documented by us is that Postgres doesn't generate
any such error code. Must be coming from some client-side software you
are using.

regards, tom lane


From: "Donald Fraser" <postgres(at)kiwi-fraser(dot)net>
To: "[ADMIN]" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Missing documentation for error code: 80S01
Date: 2011-04-12 15:30:33
Message-ID: 15A735B1CE17411AA78C8191AAC90E2C@DEVELOP1
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin pgsql-bugs pgsql-jdbc


----- Original Message -----
From: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>

> "Donald Fraser" <postgres(at)kiwi-fraser(dot)net> writes:
>> Correction error code should be:
>> 08S01
>> and NOT
>> 80S01
>
> The reason it's not documented by us is that Postgres doesn't generate
> any such error code. Must be coming from some client-side software you
> are using.

Yes you are correct, it is coming from the PostgreSQL JDBC driver.

Thanks.


From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "Donald Fraser" <postgres(at)kiwi-fraser(dot)net>, "[ADMIN]" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Missing documentation for error code: 80S01
Date: 2011-04-12 15:36:50
Message-ID: 4DA42B42020000250003C6F8@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin pgsql-bugs pgsql-jdbc

"Donald Fraser" <postgres(at)kiwi-fraser(dot)net> wrote:

> I was expecting the code to be something like: crash_shutdown,
> however that appears to be under a completely different error
> class: 57P02.

If a JDBC client detects that the connection is broken, how would it
know that it is because the server crashed?

-Kevin


From: "Donald Fraser" <postgres(at)kiwi-fraser(dot)net>
To: "[JDBC]" <pgsql-jdbc(at)postgresql(dot)org>, "[ADMIN]" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Missing documentation for error code: 80S01
Date: 2011-04-12 16:04:31
Message-ID: 3670D8885C9549A393E47A0C1582B07A@DEVELOP1
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin pgsql-bugs pgsql-jdbc

----- Original Message -----
From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>

> "Donald Fraser" <postgres(at)kiwi-fraser(dot)net> wrote:
>
>> I was expecting the code to be something like: crash_shutdown,
>> however that appears to be under a completely different error
>> class: 57P02.
>
> If a JDBC client detects that the connection is broken, how would it
> know that it is because the server crashed?
>
You are correct how could it. However the JDBC driver does know
that the server has terminated the connection and not an
IO error (via end of stream or EOF).

Is the error class "57" a better prefix for this type of error?
Knowing that the the only options for server shut down are:
Admin shut-down or Crash shut-down ?

Regards
Donald


From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "Donald Fraser" <postgres(at)kiwi-fraser(dot)net>, "[ADMIN]" <pgsql-admin(at)postgresql(dot)org>, "[JDBC]" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Missing documentation for error code: 80S01
Date: 2011-04-12 19:16:02
Message-ID: 4DA45EA2020000250003C711@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin pgsql-bugs pgsql-jdbc

"Donald Fraser" <postgres(at)kiwi-fraser(dot)net> wrote:

> the JDBC driver does know that the server has terminated the
> connection [...] (via end of stream or EOF).
>
> Is the error class "57" a better prefix for this type of error?

Possibly. Is it really true that the client will see a clean close
for a canceled query or a clean server shutdown and never see a
clean close of the TCP connection from the server side for other
reasons?

-Kevin


From: "Donald Fraser" <postgres(at)kiwi-fraser(dot)net>
To: "[JDBC]" <pgsql-jdbc(at)postgresql(dot)org>, "[ADMIN]" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Missing documentation for error code: 80S01
Date: 2011-04-13 09:57:05
Message-ID: 6A526FFBDB9D4EE2947C4E5E282530E3@DEVELOP1
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin pgsql-bugs pgsql-jdbc


From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>

> "Donald Fraser" <postgres(at)kiwi-fraser(dot)net> wrote:
>
>> the JDBC driver does know that the server has terminated the
>> connection [...] (via end of stream or EOF).
>>
>> Is the error class "57" a better prefix for this type of error?
>
> Possibly. Is it really true that the client will see a clean close
> for a canceled query or a clean server shutdown and never see a
> clean close of the TCP connection from the server side for other
> reasons?

Technically yes. When performing a read on the socket you get -1 indicating
EOF or remote socket closed. You don't get an IO error.
The difficult part is what was the client doing when the server closes the
socket?
If the client wasn't doing anything then the next likely action a client
would perform is to execute a query which would involve writing to the
socket first and in this case you will get a broken pipe IO exception,
rather than remote socket closed.
If the client had already executed a query and was attempting to read
response data then you get remote socket closed.

I would like to propose that when a "remote socket closed" is detected that
the JDBC driver uses a different error code to the one used for IO
exceptions.
Currently for IO exceptions error code is: "08S01"
For detection of remote socket closed, the error code should be different -
may be "08S02" or "57P00"?
I'm not really sure where or how these numbers are supposed to be
used/generated.
The "08" class would seem to be the most appropriate since it is
connection related.

Regards
Donald Fraser


From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Donald Fraser <postgres(at)kiwi-fraser(dot)net>
Cc: "[JDBC]" <pgsql-jdbc(at)postgresql(dot)org>, "[ADMIN]" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: [JDBC] Missing documentation for error code: 80S01
Date: 2011-04-13 10:30:17
Message-ID: BANLkTimwwzsxhq36T4k7jNUexPEiyeVz_w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin pgsql-bugs pgsql-jdbc

On 13 April 2011 21:57, Donald Fraser <postgres(at)kiwi-fraser(dot)net> wrote:

> Technically yes. When performing a read on the socket you get -1 indicating
> EOF or remote socket closed. You don't get an IO error.
> The difficult part is what was the client doing when the server closes the
> socket?
> If the client wasn't doing anything then the next likely action a client
> would perform is to execute a query which would involve writing to the
> socket first and in this case you will get a broken pipe IO exception,
> rather than remote socket closed.
> If the client had already executed a query and was attempting to read
> response data then you get remote socket closed.
>
> I would like to propose that when a "remote socket closed" is detected that
> the JDBC driver uses a different error code to the one used for IO
> exceptions.

If the server is shut down mid-query, doesn't the backend complete the
current query cycle before closing the connection?
i.e. we'd see ErrorResponse, ReadyForQuery, and return control to the
app before seeing EOF anyway?
The protocol spec is a bit vague there.

Oliver


From: "Donald Fraser" <postgres(at)kiwi-fraser(dot)net>
To: "[BUGS]" <pgsql-bugs(at)postgresql(dot)org>, "[ADMIN]" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: [JDBC] Missing documentation for error code: 80S01
Date: 2011-04-13 10:52:13
Message-ID: D100DC2FEE9E48788D640D6E7E110D21@DEVELOP1
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin pgsql-bugs pgsql-jdbc


From: "Oliver Jowett" <oliver(at)opencloud(dot)com>
> If the server is shut down mid-query, doesn't the backend complete the
> current query cycle before closing the connection?
> i.e. we'd see ErrorResponse, ReadyForQuery, and return control to the
> app before seeing EOF anyway?
> The protocol spec is a bit vague there.

From an observation perspective only: It would seem that in the case where
the server is shut down gracefully yes, however in the case where the server
has either crashed or the connection terminated un-gracefully via software
control (for example a C funcion: elog(FATAL, "Terminating connection...");)
then no.

Donald


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Donald Fraser <postgres(at)kiwi-fraser(dot)net>
Cc: "[BUGS]" <pgsql-bugs(at)postgresql(dot)org>, "[ADMIN]" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: [BUGS] [JDBC] Missing documentation for error code: 80S01
Date: 2011-04-25 19:57:17
Message-ID: BANLkTi=QOf2v3fZhTPqq3TLR+-HeQFgJnA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-admin pgsql-bugs pgsql-jdbc

On Wed, Apr 13, 2011 at 6:52 AM, Donald Fraser <postgres(at)kiwi-fraser(dot)net> wrote:
>> If the server is shut down mid-query, doesn't the backend complete the
>> current query cycle before closing the connection?
>> i.e. we'd see ErrorResponse, ReadyForQuery, and return control to the
>> app before seeing EOF anyway?
>> The protocol spec is a bit vague there.
>
> From an observation perspective only: It would seem that in the case where
> the server is shut down gracefully yes, however in the case where the server
> has either crashed or the connection terminated un-gracefully via software
> control (for example a C funcion: elog(FATAL, "Terminating connection...");)
> then no.

A smart shutdown waits for clients to exit on their own. A fast or
immediate shutdown kills them immediately, even mid-query.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company