Thread: PGSQL ERROR: FATAL: terminating connection due to administrator command

PGSQL ERROR: FATAL: terminating connection due to administrator command

From
"pobox@verysmall.org"
Date:
I have a PostgreSQL 8.2.6 on FreeBSD 6.3 (but the described behavior
appears during several earlier minor versions as well) - which powers a
php based web application. What I experience is the message (below)
which appears during the first 5-7 clicks after the database has been
cleanly imported (dropped and imported) -

PGSQL ERROR: FATAL: terminating connection due to administrator command
server closed the connection unexpectedly
    This probably means the server terminated abnormally
    before or while processing the request.

The message does not appear on every click. It can appear on the 1st,
then not on the 2nd, then on the 3rd and so on. After few more clicks
everything goes well until the next import.

I could not find anything meaningful in the logs...

Has somebody else experienced anything similar?

Iv

Re: PGSQL ERROR: FATAL: terminating connection due to administrator command

From
Jorge Godoy
Date:
Em Monday 04 February 2008 08:42:16 pobox@verysmall.org escreveu:
> I have a PostgreSQL 8.2.6 on FreeBSD 6.3 (but the described behavior
> appears during several earlier minor versions as well) - which powers a
> php based web application. What I experience is the message (below)
> which appears during the first 5-7 clicks after the database has been
> cleanly imported (dropped and imported) -
>
> PGSQL ERROR: FATAL: terminating connection due to administrator command
> server closed the connection unexpectedly
>     This probably means the server terminated abnormally
>     before or while processing the request.
>
> The message does not appear on every click. It can appear on the 1st,
> then not on the 2nd, then on the 3rd and so on. After few more clicks
> everything goes well until the next import.
>
> I could not find anything meaningful in the logs...
>
> Has somebody else experienced anything similar?

Have you checked your code and seen what is really happening on these clicks?
I had some cases where looking for unexisting information or trying to
operate on unexisting data crashed the specific process of the backend that
was serving my application.

Enable query logging and see what is happening.

--
Jorge Godoy      <jgodoy@gmail.com>


Re: PGSQL ERROR: FATAL: terminating connection due to administrator command

From
"pobox@verysmall.org"
Date:
Jorge Godoy wrote:
> Have you checked your code and seen what is really happening on these clicks?

I have been trying to catch the error from within php, however
PostgreSQL (in the described case) dies in a way which does not return
any error.

The error returned is that php can't connect to the db server.

> I had some cases where looking for unexisting information or trying to
> operate on unexisting data crashed the specific process of the backend that
> was serving my application.

The behavior happens as well simply on refresh, so I can't imagine it
being due to missing data...

> Enable query logging and see what is happening.

I did not know about query logging, thank you for the tip, I'll try that
now.

Iv

Re: PGSQL ERROR: FATAL: terminating connection due to administrator command

From
Alvaro Herrera
Date:
pobox@verysmall.org wrote:
> I have a PostgreSQL 8.2.6 on FreeBSD 6.3 (but the described behavior
> appears during several earlier minor versions as well) - which powers a
> php based web application. What I experience is the message (below)
> which appears during the first 5-7 clicks after the database has been
> cleanly imported (dropped and imported) -
>
> PGSQL ERROR: FATAL: terminating connection due to administrator command
> server closed the connection unexpectedly
>     This probably means the server terminated abnormally
>     before or while processing the request.

It's not unlikely that the server is crashing.  This should not happen.
Please examine the logs and let us know what you find.

If it's indeed crashing, we would like to see a more complete report
(possibly including a backtrace from a core dump).

--
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

Re: PGSQL ERROR: FATAL: terminating connection due to administrator command

From
"pobox@verysmall.org"
Date:
Alvaro Herrera wrote:
> It's not unlikely that the server is crashing.  This should not happen.
> Please examine the logs and let us know what you find.
>
> If it's indeed crashing, we would like to see a more complete report
> (possibly including a backtrace from a core dump).

I enabled the highest level of logging possible (debug5) and there us
nothing logged when this happens.

Can this mean that it is some php <-> PostgreSQL problem?

--


Re: PGSQL ERROR: FATAL: terminating connection due to administrator command

From
Alvaro Herrera
Date:
pobox@verysmall.org wrote:
> Alvaro Herrera wrote:
>> It's not unlikely that the server is crashing.  This should not happen.
>> Please examine the logs and let us know what you find.
>>
>> If it's indeed crashing, we would like to see a more complete report
>> (possibly including a backtrace from a core dump).
>
> I enabled the highest level of logging possible (debug5) and there us
> nothing logged when this happens.
>
> Can this mean that it is some php <-> PostgreSQL problem?

No, I think it means you have not configured logging correctly.

--
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

Re: PGSQL ERROR: FATAL: terminating connection due to administrator command

From
Tom Lane
Date:
"pobox@verysmall.org" <pobox@verysmall.org> writes:
> I have a PostgreSQL 8.2.6 on FreeBSD 6.3 (but the described behavior
> appears during several earlier minor versions as well) - which powers a
> php based web application. What I experience is the message (below)
> which appears during the first 5-7 clicks after the database has been
> cleanly imported (dropped and imported) -

> PGSQL ERROR: FATAL: terminating connection due to administrator command

This means that something sent the server process a SIGTERM signal.

One way that could happen is if the postmaster gets sent a SIGINT
(it will SIGTERM all its children and then quit).  However, if you
are able to reconnect to the database afterwards, then that's
not what's happening because the postmaster must still be there.

You need to trawl around for some mechanism within your system that
might be SIGTERM'ing server processes.  I've heard of systems that
do this when a process exceeds some ulimit setting (though I didn't
think FreeBSD was one).  Also, if you are starting the postmaster
from a terminal window rather than a system init script, you should
check into the possibility that actions such as closing the terminal
window are causing it.

            regards, tom lane