When downloading a compiler, py-solc-x acquires a lock for a file named /tmp/.solcx-lock-XXX, where XXX is the solc version currently processed. The lock file remains even after releasing the lock and finishing the program that uses py-solc-x (which is how fctl locks are supposed to work). However, when another user performs a similar operation resulting in the same lock file id (e.g., loading the same solc version), this operation will fail, as the lock file already exists, but is owned by the former user.
Environment information
py-solc-x
Version: 1.1.1What was wrong?
When downloading a compiler,
py-solc-x
acquires a lock for a file named/tmp/.solcx-lock-XXX
, where XXX is the solc version currently processed. The lock file remains even after releasing the lock and finishing the program that usespy-solc-x
(which is howfctl
locks are supposed to work). However, when another user performs a similar operation resulting in the same lock file id (e.g., loading the same solc version), this operation will fail, as the lock file already exists, but is owned by the former user.How can it be fixed?
Add the user id to the name of the lock file. In
py-solc-x/solcx/utils/lock.py
, the following changes are required.Import the package
getpass
.Replace the line
(in
_ProcessLock.__init__
, currently line 39) by