hugo --gc isn’t completing with version 0.111.1
Maybe just me?
Failed to prune cache…
… The process cannot access the file because it is being used by another process.
Tried going to the older version but I have used the new page functionality so it won’t run.
Thanks.
I suggest taking out the page
function, going back to whatever version you were using before, and see if the problem persists. I’ve been running v0.111.1 with the --gc
option without any problems.
I just ran it on a backup from mid-jan
hugo v0.108.0 works, 0.111.1 fails with same errors.
Probably a Windows thing as it refers to a folder in \AppData\Temp .
Put the page
function back in, remove \AppData\Temp\hugo_cache\
, and try again with v0.111.1.
Tried to clear Temp already but I do have more info now.
Error: failed to prune cache “getresource”: remove C:\Users\photo\AppData\Local\Temp\hugo_cache\projectname\filecache\getresource: The process cannot access the file because it is being used by another process.
If I run it a few more times (with same error) if moves on to:
Error: failed to prune cache “getcsv”
Few more times, gives the getresource error
Few more times, then a getjson error
So I put a blank text file called “test”, in each of the folders, getresource, getjson, getcsv.
It worked…
Delete the empty test file from one of the folders (getresource), hugo -gc fails with the getresource being used by another process error.
Put the empty file back, works again.
Still unable to reproduce on Linux.
Tried with empty dirs:
./
├── getcsv/
├── getjson/
└── getresource/
Tried with one of the dirs populated:
./
├── getcsv/
├── getjson/
└── getresource/
└── 12745487169922246175
Best guess…
We changed how we interact with the file system in v0.111.0:
https://github.com/gohugoio/hugo/commit/d453c12742e992d672fcf3e61b7a5ed35391c4b0
And the file systems (Windows vs Linux) are different. Before pinging bep, can you reproduce this with a new, really simple test project?
With a simple test site I am unable to reproduce on Win 11 using the same tests as above. So it’s either something about your project or your system that is triggering this on v0.111.1 but not on v0.110.0 and earlier.
Other possibilities…
The process cannot access the file because it is being used by another process
Could a virus scanner or something else have a handle on the files/dirs we’re trying to prune? Maybe we deal with that condition differently than we used to.
Anything related to permissions. I tested as a member of the Administrators group on Win 11.
Long shot, but I assume your profile is not synced via OneDrive, DropBox, Google Drive, etc.
I can confirm the same error on running hugo --gc
with v 0.111.1
on Windows 10.
Error: failed to prune cache "getcsv": remove C:\Users\arif\AppData\Local\Temp\hugo_cache\arifsite\filecache\getcsv: The process cannot access the file because it is being used by another process.
I delete the hugo_cache
folder, run hugo --gc
again`, new issue
Error: failed to prune cache "getjson": remove C:\Users\arif\AppData\Local\Temp\hugo_cache\arifsite\filecache\getjson: The process cannot access the file because it is being used by another process.
NB: I am not using the new page
function.
Update: Same error occurs with a fresh Hugo site/theme.
@bep Two reports. Both Windows.
That’s the thing, the files can’t be locked, they are not there!
I had a resources/_gen/mypage/subfolder that was previously cleaned with an older version. So there were no images in it.
0.111.1 --gc gave the same sort of error hitting that folder until I deleted it.
That or a bug in Go 1.20. (both would be a bug in Go 1.20 I guess) Anyhow, looks like I need to boot my Windows VM.