vacuum fails with "could not open statistics file" "Device or resource busy"

Started by Andres Freundabout 7 years ago3 messages
#1Andres Freund
andres@anarazel.de

Hi,

buildfarm member lorikeet had an interesting buildfarm failure in the
logical decoding test. The failure looks unrelated to logical decoding,
but might be more widely relevant:

https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=lorikeet&dt=2018-10-19%2011%3A22%3A34
VACUUM FULL pg_class;
+ WARNING: could not open statistics file "pg_stat_tmp/global.stat": Device or resource busy

Now that animal is cygwin based, so maybe it's just some random
weirdness. But ISTM it could also indicate a bug of some sort.

Were it native windows, I'd assume we'd keep a file open with the wrong
flags or such...

Greetings,

Andres Freund

#2Tomas Vondra
tomas.vondra@2ndquadrant.com
In reply to: Andres Freund (#1)
Re: vacuum fails with "could not open statistics file" "Device or resource busy"

Hi,

On 10/20/2018 04:15 AM, Andres Freund wrote:

Hi,

buildfarm member lorikeet had an interesting buildfarm failure in the
logical decoding test. The failure looks unrelated to logical decoding,
but might be more widely relevant:

https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=lorikeet&dt=2018-10-19%2011%3A22%3A34
VACUUM FULL pg_class;
+ WARNING: could not open statistics file "pg_stat_tmp/global.stat": Device or resource busy

Now that animal is cygwin based, so maybe it's just some random
weirdness. But ISTM it could also indicate a bug of some sort.

Were it native windows, I'd assume we'd keep a file open with the wrong
flags or such...

Interesting. After a bit more digging, I've found these two places
discussing stats files and "device or resource busy":

[1]: /messages/by-id/51B59794.3000500@gmail.com

[2]: https://stackoverflow.com/questions/30846804/postgresql-statistics-issue-could-not-rename-temporary-statistics-file
https://stackoverflow.com/questions/30846804/postgresql-statistics-issue-could-not-rename-temporary-statistics-file

The pgsql-hackers thread is clearly about cygwin (see the diff file).
Not sure about the SO thread, it only talks about 9.4 on windows (but I
guess it's cygwin too).

That being said, I'm not sure how to trigger it - my guess is it happens
when one process holds a file descriptor open while another process
tries to remove it, but I find it strange we'd only seen this twice
since 2013.

regards

--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

#3Andrew Dunstan
andrew@dunslane.net
In reply to: Andres Freund (#1)
Re: vacuum fails with "could not open statistics file" "Device or resource busy"

On 10/19/2018 10:15 PM, Andres Freund wrote:

Hi,

buildfarm member lorikeet had an interesting buildfarm failure in the
logical decoding test. The failure looks unrelated to logical decoding,
but might be more widely relevant:

https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=lorikeet&dt=2018-10-19%2011%3A22%3A34
VACUUM FULL pg_class;
+ WARNING: could not open statistics file "pg_stat_tmp/global.stat": Device or resource busy

Now that animal is cygwin based, so maybe it's just some random
weirdness. But ISTM it could also indicate a bug of some sort.

Were it native windows, I'd assume we'd keep a file open with the wrong
flags or such...

I have switched the stats_temp_dir of this animal to a Windows Ramdisk.
Lets' see if the problem persists.

cheers

andrew