-
Notifications
You must be signed in to change notification settings - Fork 347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lockf issue on Windows #4944
Comments
the config report:
|
cc @MisterDA just in case if you know |
I must have had this issue some time ago; and so I trained myself never to use opam concurrently... |
I fear that I have the same experience as @MisterDA - it happened at some point in the past and I filed it away! I'm fairly sure, having just poked around a little, that the fix is obvious - opam's use of I'll verify that that's actually the problem and open a PR. |
Oh, right, I thought opam was only taking regular (blocking) locks, and I could not reproduce with a simple program. But indeed, that's the problem: the error code returned when a non-blocking lock fails. The fix is as simple as: diff --git a/src/core/opamSystem.ml b/src/core/opamSystem.ml
index df2c4dd3..9ba7980a 100644
--- a/src/core/opamSystem.ml
+++ b/src/core/opamSystem.ml
@@ -1077,7 +1077,7 @@ let rec flock_update
if Sys.win32 && kind <> `Lock_none then
Unix.(lockf fd F_ULOCK 0);
Unix.lockf fd (unix_lock_op ~dontblock:true flag) 0
- with Unix.Unix_error (Unix.EAGAIN,_,_) ->
+ with Unix.Unix_error ((Unix.EAGAIN | Unix.EACCES),_,_) ->
if dontblock then
OpamConsole.error_and_exit `Locked
"Another process has locked %s and non blocking mode enabled" |
It's working! thanks |
I have a recurring issue with opam on Windows (binary is from fdopen's OCaml for Windows): a lock operation fails with a permission denied error. This happens when there is contention on the lock, for instance two CI agents starting concurrently and launching an
opam install
.I can reproduce with a command like this in the shell (installing an already installed package) :
opam install dune & opam install dune ; wait
According to the logs, this seems to be because of the write lock on a switch lock file:
but on a successful instance:
Any idea on what's causing this and if there's a way to remedy this ?
The text was updated successfully, but these errors were encountered: