mozilla / sccache

Sccache is a ccache-like tool. It is used as a compiler wrapper and avoids compilation when possible. Sccache has the capability to utilize caching in remote storage environments, including various cloud storage options, or alternatively, in local storage.
Apache License 2.0
5.74k stars 542 forks source link

sccache keeps lock on .vcpkg-root #1855

Open marcsanfacon opened 1 year ago

marcsanfacon commented 1 year ago

Hello, we are using sccache (0.5.4) in our projects alongside vcpkg as our C++ package manager.

Once in a while, our build is stuck on the configure part and we have this message:

[build] waiting to take filesystem lock on /home/ubuntu/Projects/vcpkg/.vcpkg-root...

When doing a lsof, we get the following:

sccache    6576                          ubuntu    3u      REG              253,4         0     939240 /home/ubuntu/Projects/vcpkg/.vcpkg-root
sccache    6576  6577 sccache            ubuntu    3u      REG              253,4         0     939240 /home/ubuntu/Projects/vcpkg/.vcpkg-root
sccache    6576  6578 tokio-run          ubuntu    3u      REG              253,4         0     939240 /home/ubuntu/Projects/vcpkg/.vcpkg-root
sccache    6576  6579 tokio-run          ubuntu    3u      REG              253,4         0     939240 /home/ubuntu/Projects/vcpkg/.vcpkg-root
sccache    6576  6580 tokio-run          ubuntu    3u      REG              253,4         0     939240 /home/ubuntu/Projects/vcpkg/.vcpkg-root
sccache    6576  6581 tokio-run          ubuntu    3u      REG              253,4         0     939240 /home/ubuntu/Projects/vcpkg/.vcpkg-root
sccache    6576  6582 tokio-run          ubuntu    3u      REG              253,4         0     939240 /home/ubuntu/Projects/vcpkg/.vcpkg-root

Restarting sccache server does the trick and unblocks our build process.

Tiwalun commented 1 year ago

I'm seeing the same issue, and I think it might be related to how the sccache server is started.

I've tried debugging this by starting sccache separately using the following command line:

SCCACHE_LOG=debug SCCACHE_START_SERVER=1 SCCACHE_NO_DAEMON=1 SCCACHE_IDLE_TIMEOUT=0 sccache

After this, the error does not occur any more.

marcsanfacon commented 1 year ago

Thanks for the feedback and reproducing the issue.

So what you're doing is running the server in a terminal and keep it running there instead of spawning it as daemon and this solves the issue?

Interesting, I'll give this a try. However, there is still a bug in sccache that keeps file open when in daemon mode.