Re: AlterSubscription_refresh "wrconn" wrong variable?

From: Peter Smith <smithpb2250(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Peter Eisentraut <peter_e(at)gmx(dot)net>
Subject: Re: AlterSubscription_refresh "wrconn" wrong variable?
Date: 2021-05-04 05:13:24
Message-ID: CAHut+PtJcDmh40urPri9gcn4i9FXAUww1ZMYkPxh6E7v3FLDRQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, May 4, 2021 at 2:31 PM Andres Freund <andres(at)anarazel(dot)de> wrote:
>
> Hi,
>
> On 2021-05-04 09:29:42 +1000, Peter Smith wrote:
> > While reviewing some logical replication code I stumbled across a
> > variable usage that looks suspicious to me.
>
> > Note that the AlterSubscription_refresh function (unlike other
> > functions in the subscriptioncmds.c) is using the global variable
> > "wrconn" instead of a local stack variable of the same name. I was
> > unable to think of any good reason why it would be deliberately doing
> > this, so my guess is that it is simply an accidental mistake that has
> > gone unnoticed because the compiler was silently equally happy just
> > using the global var.
>
> > Apparently, this is not causing any reported problems because it seems
> > like the code has been this way for ~4 years [1].
>
> This sounded vaguely familiar. After a bit of searching I found that's
> because I debugged a crash related to it:
> https://www.postgresql.org/message-id/20201111215820.qihhrz7fayu6myfi%40alap3.anarazel.de
>

Oh! No wonder it sounded familiar.

It looks like I've just re-discovered the identical problem 5 months
after your post.

------
Kind Regards,
Peter Smith.
Fujitsu Australia

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message vignesh C 2021-05-04 05:34:23 Re: Replication slot stats misgivings
Previous Message Peter Smith 2021-05-04 05:08:11 Re: AlterSubscription_refresh "wrconn" wrong variable?