Re: Terminate the idle sessions

Japin Li <japinli@hotmail.com>

From: Li Japin <japinli@hotmail.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: "David G. Johnston" <david.g.johnston@gmail.com>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2020-06-10T13:53:12Z
Lists: pgsql-hackers

On Jun 10, 2020, at 4:25 PM, Michael Paquier <michael@paquier.xyz<mailto:michael@paquier.xyz>> wrote:

Idle sessions staying around can be a problem in the long run as they
impact snapshot building.  You could for example use a background
worker to do this work, like that:
https://github.com/michaelpq/pg_plugins/tree/master/kill_idle

Why not implement it in the core of Postgres? Are there any disadvantages of
implementing it in the core of Postgres?

Japin Li

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.