Re: pgsql: pgstat: Bring up pgstat in BaseInit() to fix uninitialized use o

From: Andres Freund <andres(at)anarazel(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: pgstat: Bring up pgstat in BaseInit() to fix uninitialized use o
Date: 2021-08-07 05:11:49
Message-ID: 20210807051149.x2j3n64ejcu23hm4@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Hi,

On 2021-08-06 21:49:52 -0700, Andres Freund wrote:
> The temp file is created by InitializeBackupManifest(). In the !OSX case, we
> first abort via an ERROR, which triggers the cleanup via
> WalSndResourceCleanup(). On OSX however, we immediately error out with FATAL
> for some reason (timing? network buffering differences?), which will never
> reach WalSndErrorCleanup(). Therefore the temp file only gets deleted during
> proc_exit(), which triggers the issue...
>
> Not yet really sure what the best way to deal with this is. Presumably this
> issue would be fixed if AtProcExit_Files()/CleanupTempFiles() were scheduled
> via before_shmem_exit(). And perhaps it's not too off to schedule
> CleanupTempFiles() there - but it doesn't quite seem entirely right either.

Huh. I just noticed that AtProcExit_Files() is not even scheduled via
on_shmem_exit() but on_proc_exit(). That means that even before fb2c5028e63
we sent pgstat messages *well* after pgstat_shutdown_hook() already
ran. Crufty.

Just hacking in an earlier CleanupTempFiles() does "fix" the OSX issue:
https://cirrus-ci.com/task/5941265494704128?logs=macos_basebackup#L4

I'm inclined to leave things as-is until tomorrow to see if other things are
shaken loose and then either commit a bandaid along those lines or revert the
patch. Or something proper if we can figure it out till then.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2021-08-07 10:45:50 pgsql: Message style improvements
Previous Message Andres Freund 2021-08-07 04:49:52 Re: pgsql: pgstat: Bring up pgstat in BaseInit() to fix uninitialized use o

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2021-08-07 05:35:55 Re: [BUG] wrong refresh when ALTER SUBSCRIPTION ADD/DROP PUBLICATION
Previous Message Andres Freund 2021-08-07 04:49:52 Re: pgsql: pgstat: Bring up pgstat in BaseInit() to fix uninitialized use o