Re: postgres_fdw - cached connection leaks if the associated user mapping/foreign server is dropped

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: Zhihong Yu <zyu(at)yugabyte(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
Subject: Re: postgres_fdw - cached connection leaks if the associated user mapping/foreign server is dropped
Date: 2020-12-15 03:08:22
Message-ID: CALj2ACV82G1qy6UcratW4HxExiJp0_GuizB6NT31S_VBsMGE-A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Dec 15, 2020 at 8:25 AM Zhihong Yu <zyu(at)yugabyte(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2020-12-15 03:19:02 Re: Proposed patch for key managment
Previous Message Kyotaro Horiguchi 2020-12-15 03:04:35 Re: Add Information during standby recovery conflicts