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

From Bharath Rupireddy
Subject Re: postgres_fdw - cached connection leaks if the associated user mapping/foreign server is dropped
Date
Msg-id CALj2ACV82G1qy6UcratW4HxExiJp0_GuizB6NT31S_VBsMGE-A@mail.gmail.com
Whole thread Raw
In response to Re: postgres_fdw - cached connection leaks if the associated user mapping/foreign server is dropped  (Zhihong Yu <zyu@yugabyte.com>)
Responses RE: postgres_fdw - cached connection leaks if the associated user mapping/foreign server is dropped
List 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



pgsql-hackers by date:

Previous
From: Kyotaro Horiguchi
Date:
Subject: Re: Add Information during standby recovery conflicts
Next
From: Bruce Momjian
Date:
Subject: Re: Proposed patch for key managment