Terminating connection because of crash of another server process -Postgres - postgresql

Everytime i run the same query i'm getting this error:
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.
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
connection to server was lost
I'm using phpPgAdmin 5.1.

A concurrent query in a different database session has crashed its server backend process. As a consequence, the whole database stops and performs crash recovery from the latest checkpoint.
You should look into the database server log to see what the problem is.

Related

PostgreSQL crashing repeatedly

My PostgreSQL DB crashing repeatedly for running only 5-10 min. and below log prints:
LOG: database system was shut down at 2022-12-12 09:40:32 PKT
LOG: database system is ready to accept connections
LOG: autovacuum launcher started
LOG: server process (PID 10780) exited with exit code 255
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.
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: pre-existing shared memory block is still in use
HINT: Check if there are any old server processes still running, and terminate them.
Tried to restart the JasperreportsPostgreSQL service but it only run for 5-10 min.

Google Coud SQL Postgres Database kills process and enters recovery mode

I'm seeing my client's Cloud SQL database go into recovery mode every day or two. All connections are rejected with the error:
Every time this is proceeded by log messages stating:
server process (PID 2883588) was terminated by signal 9: Killed
The SQL query is logged, always the same query
terminating any other active server processes
Then many: terminating connection because of crash of another server process
At which point the database comes back in recovery mode for a few seconds, before continuing life as normal.
Why would Cloud SQL be terminating a query for me? I've run the query in question (on the same server) and it completes happily in under a millisecond. Could this be caused by transient server load?

Postgres streaming replication - servers keep shutting down

I am new to PostgreSQL and I am trying to set up a streaming replication from our server to a test DB on my laptop. I have been following this tutorial https://www.percona.com/blog/2018/09/07/setting-up-streaming-replication-postgresql/ along with the Postgres documentation here https://www.postgresql.org/docs/11/runtime-config-replication.html.
I'm running Windows 10, PostgreSQL 11, PostGIS 2.5 extension.
The server and my local machine both keep shutting down and the logs are filled with postmaster.pid errors such as:
LOG: performing immediate shutdown because data directory lock file is invalid
LOG: received immediate shutdown request
LOG: could not open file "postmaster.pid": No such file or directory
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.
Could anyone point me towards the issue here? I know my server's aren't configured properly but I just don't know what configurations need to be changed.
Here is an image of my standby server's most recent log.
standby log
Here is an image of my master server's most recent log.
master log
You must have messed up in many ways.
You removed or overwrote postmaster.pid on the master server.
That is very dangerous and causes the server to die with the error message you quote.
You didn't create recovery.conf before starting the standby server, or you removed backup_label. From the error messages I'd suspect the second, with ensuing data corruption.

Postgres SIGKILL crash

FYI only; this does not need an answer.
I was working on a Postgres server under heavy load, and issued a GRANT command that hung. It was not blocked by any other commands.
I had a few open connections and was able to kill several of the processes with a normal pg_cancel_backend (SIGTERM) command, but my GRANT command didn't respond to either that or pg_terminate_backend (SIGINT). I finally tried "kill -9 (pid)" (SIGKILL) and the server crashed.
Issuing SIGKILL to the database server process or the postmaster can cause crashes--that's well documented. Running SIGKILL against a child process can also crash the database.
Running SIGKILL against a child process can also crash the database
Any fatal signal that terminates any backend without a chance to clean up, such as SIGSEGV, SIGABRT, SIGKILL, etc, will cause the postmaster to assume that shared memory may be corrupt. It will roll back all transactions, terminate all running backends, and restart.
PostgreSQL does that to protect your data. If something went wrong before a backend crashed that caused it to scribble on shared memory, then shared_buffers could contain invalid data that'd get flushed to disk and replace good pages.
I was pretty sure that was in the docs, but all I can find is what I think you were referring to in shutting down the server.
Anyway, if you SIGKILL a backend you'll see something like:
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.
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Succeeded.
This also happens if the OOM killer kills a backend, which is why you should turn off memory overcommit on Linux.
I wrote some guidance on things to do and not to do with PostgreSQL on my blog. Worth a look.

postgreSQL 8.4. Error connecting to the server: FATAL: the database system is in recovery mode

I really need someone's help with this error in postgreSQL.
I have postgres installed on Windows Server 2008 R2. I'm trying to connect to it using pg-admin, some custom C# and another third-party tool that works on postgres.
Today, I've noticed that I can't connect to postgres. It gives me this error:
I'm no expert at postgres and this is a serious problem that I could not fix in a few hours. I've tried rebooting the server, restarting postgresql-8.4 service. the result is the same.
Update:
I've connected to the server with the problem via RDP.
The logs right before and after the problem contain the following information:
2014-01-29 18:47:46 MSK STATEMENT: INSERT INTO "TapeSegments"
(umid ,clip_index, markin,
markout_duration, clip_name,
state, clip_filename)
VALUES (:umid, :clip_index, :markin, :markout_duration, :clip_name, :state, :clip_filename) 2014-01-29
18:51:51 MSK LOG: server process (PID 7844) was terminated by
exception 0xC000012D 2014-01-29 18:51:51 MSK HINT: See C include file
"ntstatus.h" for a description of the hexadecimal value. 2014-01-29
18:51:51 MSK LOG: terminating any other active server processes
2014-01-29 18:51:51 MSK WARNING: terminating connection because of
crash of another server process 2014-01-29 18:51:51 MSK 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. 2014-01-29 18:51:51 MSK HINT:
In a moment you should be able to reconnect to the database and repeat
your command. 2014-01-29 18:51:51 MSK WARNING: terminating connection
because of crash of another server process 2014-01-29 18:51:51 MSK
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. 2014-01-29
18:51:51 MSK HINT: In a moment you should be able to reconnect to the
database and repeat your command. 2014-01-29 18:51:51 MSK WARNING:
terminating connection because of crash of another server process
2014-01-29 18:51:51 MSK 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. 2014-01-29 18:51:51 MSK HINT: In a moment you should be able
to reconnect to the database and repeat your command. 2014-01-29
18:51:51 MSK WARNING: terminating connection because of crash of
another server process 2014-01-29 18:51:51 MSK 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. 2014-01-29 18:51:51 MSK HINT: In a
moment you should be able to reconnect to the database and repeat your
command. 2014-01-29 18:51:52 MSK WARNING: terminating connection
because of crash of another server process 2014-01-29 18:51:52 MSK
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. 2014-01-29
18:51:52 MSK HINT: In a moment you should be able to reconnect to the
database and repeat your command. 2014-01-29 18:51:52 MSK WARNING:
terminating connection because of crash of another server process
2014-01-29 18:51:52 MSK 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. 2014-01-29 18:51:52 MSK HINT: In a moment you should be able
to reconnect to the database and repeat your command. 2014-01-29
18:51:53 MSK FATAL: the database system is in recovery mode
2014-01-29 18:51:54 MSK FATAL: the database system is in recovery
mode
So, basically, postgres is stuck on "the database system is shutting down" Is there anything I can do to "kick it", so to speak?
This is a development server with no clusters, nothing fancy.
Update 2:
I've tried to connect to the server with the following command:
"C:\Program Files (x86)\PostgreSQL\8.4\bin\psql.exe" -U postgres -l -h ntv.ncdev.ru -p 5433
It gives me the same error:
psql: FATAL: the database system is shutting down
The exception 0xC000012D is "Out of Virtual Memory".
Increase the size of your virtual memory paging file.
Source here.