Re: postgres_fdw - cached connection leaks if the associated user mapping/foreign server is dropped
Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
From: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
To: Zhihong Yu <zyu@yugabyte.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>,
Fujii Masao <masao.fujii@oss.nttdata.com>
Date: 2020-12-15T03:08:22Z
Lists: pgsql-hackers
On Tue, Dec 15, 2020 at 8:25 AM Zhihong Yu <zyu@yugabyte.com> wrote: > Is the following sequence possible ? > In pgfdw_inval_callback(): > > entry->invalidated = true; > + have_invalid_connections = true; > > At which time the loop in pgfdw_xact_callback() is already running (but past the above entry). > Then: > > + /* We are done closing all the invalidated connections so reset. */ > + have_invalid_connections = false; > > At which time, there is still at least one invalid connection but the global flag is off. It's not possible, as this backend specific code doesn't run in multiple threads. We can not have pgfdw_inval_callback() and pgfdw_xact_callback() running at the same time, so we are safe there. With Regards, Bharath Rupireddy. EnterpriseDB: http://www.enterprisedb.com
Commits
-
postgres_fdw: Fix connection leak.
- b5c73eef8adf 9.5.25 landed
- 03b7a1ee7b7f 9.6.21 landed
- 744357d8461c 10.16 landed
- 294cdd7d0fff 11.11 landed
- e792ca4aca26 12.6 landed
- 546f143740a0 13.2 landed
- e3ebcca843a4 14.0 landed