Re: Terminate the idle sessions

Japin Li <japinli@hotmail.com>

From: Li Japin <japinli@hotmail.com>
To: "David G. Johnston" <david.g.johnston@gmail.com>
Cc: "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2020-06-10T05:20:36Z
Lists: pgsql-hackers

On Jun 9, 2020, at 10:35 PM, David G. Johnston <david.g.johnston@gmail.com<mailto:david.g.johnston@gmail.com>> wrote:

I’m curious as to the use case because I cannot imagine using this.  Idle connections are normal.  Seems better to monitor them and conditionally execute the disconnect backend function from the monitoring layer than indiscriminately disconnect based upon time.

I agree with you.  But we can also give the user to control the idle sessions lifetime.

Commits

  1. Rethink SQLSTATE code for ERRCODE_IDLE_SESSION_TIMEOUT.

  2. Improve commentary in timeout.c.

  3. Add idle_session_timeout.

  4. Improve timeout.c's handling of repeated timeout set/cancel.