0

When I tried to kill one idle connection. Using the below query

select pg_terminate_backend(24861);

I am getting the below log.

2021-07-26 18:45:32 UTC:192.168.26.250(56021):postgres@demo_uat:[24861]:FATAL: terminating connection due to administrator command
2021-07-26 18:45:33 UTC:192.168.26.250(59691):[unknown]@[unknown]:[543]:LOG: PID 24861 in cancel request did not match any process

It seems like the PID disappears after this query. Because when I run this query again I get the below log.

postgres@postgres:[26522]:WARNING: PID 24861 is not a PostgreSQL server process

But one more idle connection is being opened under a different PID.

For example, if I have a 400 idle connection and if I kill all those connections using this query

SELECT pg_terminate_backend(pid) FROM pg_stat_activity
WHERE datname = current_database() 
AND pid <> pg_backend_pid()
AND state in ('idle');

Then another 400 idle connections are being opened under different PIDs. But I don't see anything in the log like this connection being created.

Any insight on how to solve this error will be greatly appreciated. Thanks

2
  • Unless log_connections if turned on, there is no reason for new connections to get logged.
    – jjanes
    Jul 27, 2021 at 4:02
  • You have not described any errors.
    – jjanes
    Jul 27, 2021 at 4:08

1 Answer 1

-1

You get PID 24861 in cancel request did not match any process if/when at the time you do a pg_ctl restart -m fast, you had other application(s) checking out connections to the postgres server.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.