pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Waka Ranai <wakadotranai@gmail.com>
To: pgsql-bugs@lists.postgresql.org
Subject: Re: Bug report - pg_upgrade tool seems to have a race condition when trying to delete a pg_wal file
Date: Wed, 29 May 2024 09:51:08 +0200
Message-ID: <97f7b82147f7b84d0ce3e2a8e6cff3367faedc2e.camel@cybertec.at> (raw)
In-Reply-To: <CAP8Vo=_4xK06+vLefRv8wHy9FiEbn7uOFnu2wJQrvGNF7mT5OQ@mail.gmail.com>
References: <CAP8Vo=9o0FE6gzqZJ3XdeGPNqi=eNV3cM_6v-thE640YcYoWog@mail.gmail.com>
	<3d6013e49ac684cf4e9fbb6a1eb28b068cc9c113.camel@cybertec.at>
	<CAP8Vo=9Rp6MnE3LsNo5aAkjLNueXEXjDmjvBPF3AQEwbpnfXcA@mail.gmail.com>
	<c3ea74ed3e44eaa31f8916a3e4a07c4a1eefa4df.camel@cybertec.at>
	<CAP8Vo=_4xK06+vLefRv8wHy9FiEbn7uOFnu2wJQrvGNF7mT5OQ@mail.gmail.com>

On Tue, 2024-05-28 at 16:14 +0200, Waka Ranai wrote:
> We tested on the aforementioned computer after adding an exception on the pg_wal
> folder for the Microsoft default antivirus with
> Add-MpPreference -ExclusionPath "C:\Program Files\PostgreSQL\15\data\pg_wal"
> but we still faced the same issue, I included the pg_upgrade logs

Thanks.  I see

  command: "C:/Program Files/PostgreSQL/15/bin/pg_resetwal" -f -u 536 "C:/Program Files/PostgreSQL/15/data" >> "C:/Program Files/PostgreSQL/15/data/pg_upgrade_output.d/202405>
  Write-ahead log reset


  command: "C:/Program Files/PostgreSQL/15/bin/pg_resetwal" -f -x 3466214 "C:/Program Files/PostgreSQL/15/data" >> "C:/Program Files/PostgreSQL/15/data/pg_upgrade_output.d/20>
  pg_resetwal: error: could not delete file "pg_wal/000000010000000000000001": No such file or directory

So it is failing in KillExistingXLOG(): readdir() finds the file,
but by the time unlink() is executed, the file is already gone.
The file in question is the WAL segment written by WriteEmptyXLOG() in the
previous "pg_resetwal" execution.

But the previous "pg_resetwal" has exited by the time the next one is started,
so it should not be at fault.

I found this similar thread:
https://postgr.es/m/20090910094211.166C5753FB7%40cvs.postgresql.org
The symptoms are the same.

I wonder if something like commit 4e2d5efc6a45b1f9f96df42629f6d1c7740e657e
would be useful here too.  But it cannot be a PostgreSQL process that is
holding the file open - the creating process has already exited, and no
other PostgreSQL process would read the file.

So the fact remains that there is something *outside of PostgreSQL* that
opens newly created files.  You say you disabled the virus scanner, but can
you think of any other software on your system that would do that?
Perhaps you can try disabling the virus scanner completely and check if
that gets rid of the problem.

Yours,
Laurenz Albe





view thread (9+ messages)  latest in thread

Message-ID: <97f7b82147f7b84d0ce3e2a8e6cff3367faedc2e.camel@cybertec.at>
Permalink:  ../97f7b82147f7b84d0ce3e2a8e6cff3367faedc2e.camel@cybertec.at/
Also on:    postgresql.org/message-id/97f7b82147f7b84d0ce3e2a8e6cff3367faedc2e.camel@cybertec.at

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: laurenz.albe@cybertec.at, wakadotranai@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: Bug report - pg_upgrade tool seems to have a race condition when trying to delete a pg_wal file
  In-Reply-To: <97f7b82147f7b84d0ce3e2a8e6cff3367faedc2e.camel@cybertec.at>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox