Re: vacuum fails with "could not open statistics file" "Device orresource busy" - Mailing list pgsql-hackers

From Tomas Vondra
Subject Re: vacuum fails with "could not open statistics file" "Device orresource busy"
Date
Msg-id 1506bf80-c10d-1d60-e391-b5a296109781@2ndquadrant.com
Whole thread Raw
In response to vacuum fails with "could not open statistics file" "Device orresource busy"  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
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] https://www.postgresql.org/message-id/flat/51B59794.3000500%40gmail.com

[2]
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


pgsql-hackers by date:

Previous
From: Daniel Gustafsson
Date:
Subject: Re: Remove obsolete pg_attrdef.adsrc column
Next
From: Narayanan V
Date:
Subject: Re: PostgreSQL Limits and lack of documentation about them.