Blocking waiting for file lock on package cache

I haven't used rust for a while and now when I try to run rusr file in VS code, my program freezes up and I get 'Blocking waiting for file lock on package cache' notifcation.
What can I do to fix it?

Do you have some cargo command running in the background? E.g. cargo check.


Are you sure? Rust-analyzer invokes cargo check for you in the background every time you save by default.

And how to check this?

You can look in a process monitor if there are any other cargo processes. For example ps aux | grep rustc on linux, taskmgr.exe on windows or activity monitor (i think that is the english name) on macOS.

I did what you suggested, and there were several cargo processes running. I have cancelled them, and i managed to execute program.
Thx! But are there any advices so that this problem won't happen anymore?