Advisory-db is locked on every build

Hey there. Every time I build my canisters, I get this kind of warning:

Checking for vulnerabilities in rust canisters.
    Fetching advisory database from `https://github.com/RustSec/advisory-db.git`
warning: directory /home/alexander/.cargo/advisory-db is locked, waiting for up to 300 seconds for it to become available

5 minutes is quite a big timeout to wait every time, especially when you update canisters frequently. How do I lower it to something more meaningful, like 10 sec?

Thanks in advance!

It shouldn’t be locked all the time. Do you have other processes running that may access the advisory-db? Or is it possible that the db was not released properly at some point?

Thanks for the reply!

I use turborepo to build stuff in my project. There are two subprojects, where canisters are built during this process. Turborepo tries to build them in parallel, which (as I think) is causing the problem.

I could make it build them sequentially, but it is kinda strange given that cargo is pretty much capable of parallel building.

I tried building it sequentially and I still get the error.
How do I check what’s locking it constantly?

Maybe some VSCode extension?

Uh, just ran into this as well. I know it is not an IC specific issue but just checking to see if anyone has a trick to unlock the lock.

I have:

  • Closed everything
  • Deleted the folder
  • Restarted

Still issue remains. Issue occurs on a tiny project that built just fine an hour ago.

So, I guess the issue is not with the repo, right? I might have cancelled a build in the middle of building, that might have caused it.

I figured this one out. At least in my case.

The problem is that when you run something like dfx deploy and then interrupt it (by hitting ctrl+c for example), then the lock file is created but not purged properly.

Go to ~/.cargo/advisory-db and delete the *.lock file manually.
After that the problem should go away, until you interrupt the build process again.

3 Likes

Revisiting this old topic :slight_smile:

I did Ctrl+C during dfx deploy and am now stuck with the 300 second wait every time I deploy.

The advisory-db folder does not contain a lock file. And, deleting the whole folder does no difference.

@Severin, any idea as to which process might be holding the lock. I have killed all processes vaguely dfx related but to no effect.

Maybe there is some way to disable the RustSec check?

Oh, found the lock file. For anyone running into this, it is not in the advisory-db folder but in the parent .cargo folder. Deleting it solved the issue.

2 Likes