Thread: terminating connection because of crash of another server process

terminating connection because of crash of another server process

From
sergio nogueira
Date:
Hi, all.

i have two tables (teste1 and teste2).
i was inserting one million rows on each by a script PHP.
In another process, i have created a view (ct1t2) to count rows on the tables and started it
then i killed the script (killing the apache server) and in another process i've executed the command 'truncate table teste1'
the both process (select - by the view and truncate) get locked by a long time.
then i kill the process executing the truncate.
the result:

STATEMENT:  create view ct1t2 as select count(t1.id_linha) as ct1, count(t2.id_linha) as ct2 from teste1 t1, teste2 t2;
LOG:  unexpected EOF on client connection                                                                                                              <-- when i killed apache
LOG:  server process (PID 3421) was terminated by signal 9: Killed                                                                             <-- when i killed de truncate
LOG:  terminating any other active server processes
WARNING:  terminating connection because of crash of another server process
DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
HINT:  In a moment you should be able to reconnect to the database and repeat your command.
WARNING:  terminating connection because of crash of another server process
DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
HINT:  In a moment you should be able to reconnect to the database and repeat your command.
WARNING:  terminating connection because of crash of another server process
DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
HINT:  In a moment you should be able to reconnect to the database and repeat your command.
LOG:  all server processes terminated; reinitializing
FATAL:  the database system is in recovery mode
FATAL:  the database system is in recovery mode
LOG:  database system was interrupted; last known up at 2009-06-14 11:25:32 BRT
LOG:  database system was not properly shut down; automatic recovery in progress
LOG:  record with zero length at 3/FC97C88C
LOG:  redo is not required
LOG:  autovacuum launcher started
LOG:  database system is ready to accept connections  

Any idea on how to prevent this?

i'm using PostgreSQL 8.3.6 on Fedora10
Sorry by my english. I hope you can understand ...

Att.,
Sergio Nogueira


Re: terminating connection because of crash of another server process

From
Tom Lane
Date:
sergio nogueira <sergiopnog@gmail.com> writes:
> then i kill the process executing the truncate.
> the result:

> LOG:  server process (PID 3421) was terminated by signal 9:
> Killed

> Any idea on how to prevent this?

Don't do that.  kill -9 is *never* the recommended way to terminate a
query.  Next time try kill -INT, if you must do something like this.

            regards, tom lane