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

From: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers(at)postgresql(dot)org, andrew(at)dunslane(dot)net
Subject: Re: vacuum fails with "could not open statistics file" "Device or resource busy"
Date: 2018-10-27 23:01:49
Message-ID: 1506bf80-c10d-1d60-e391-b5a296109781@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Narayanan V 2018-10-28 01:10:14 Re: PostgreSQL Limits and lack of documentation about them.
Previous Message Daniel Gustafsson 2018-10-27 21:19:20 Re: Remove obsolete pg_attrdef.adsrc column