ocaml / dune

A composable build system for OCaml.
https://dune.build/
MIT License
1.64k stars 409 forks source link

Potential bug: dune commands no longer work after updating macOS to Ventura #7448

Open tonyhuang12138 opened 1 year ago

tonyhuang12138 commented 1 year ago

Expected Behavior

After updating to the latest macOS (Version 13.3 (22E252)) today and latest dune version (3.7.0), running dune build produces the error 'Error: write(): Operation timed out' for me.

Reproduction

Below is the content of my dune file:

(executable
 (public_name platypus)
 (name toplevel)
 (libraries
  platypus
  llvm
  llvm.analysis
  llvm.executionengine
  llvm.bitwriter
  ctypes.foreign))

(rule
 (target scanner.ml)
 (deps scanner.mll)
 (action
  (chdir
   %{workspace_root}
   (run %{bin:ocamllex} -q -o %{target} %{deps}))))

(rule
 (targets parser.ml parser.mli)
 (deps parser.mly)
 (action
  (chdir
   %{workspace_root}
   (run %{bin:ocamlyacc} -v %{deps}))))
rgrinberg commented 1 year ago

Can you run the dune command reproducing this error with --debug-backtraces and show us the stacktrace?

tonyhuang12138 commented 1 year ago

Hi, below is the output from running dune build --debug-backtraces, thanks!

Screenshot 2023-03-30 at 8 18 51 AM
Alizter commented 1 year ago

Do you have a file _build/.lock? If so, can you delete it and try again?

tonyhuang12138 commented 1 year ago

Do you have a file _build/.lock? If so, can you delete it and try again?

Just removed the file and everything worked. Thanks!

Alizter commented 1 year ago

I'm going to keep this open as you shouldn't have to do this by hand. It looks like we have a case that we haven't accounted for so we will try to work out what happened here.

Alizter commented 1 year ago

@tonyhuang12138 just to check, are you using an m1/m2 chip?

tonyhuang12138 commented 1 year ago

@tonyhuang12138 just to check, are you using an m1/m2 chip?

Yes, I have a M1 Pro chip.

rgrinberg commented 1 year ago

Are you using NFS or something? I have no idea how a write could timeout without a socket in there somewhere.

tonyhuang12138 commented 1 year ago

I'm not entirely sure. My suspicion is that my folder is also stored on OneDrive.

Alizter commented 1 year ago

FTR @anmonteiro was not able to reproduce this on an m2. Unless there is more information you can give us, it seems to have been a one off. I suspect that maybe there was a permission error, but I am unable to test this.

Usually when Dune encounters a lock, it will check if there is another Dune process with ownership. If there isn't, it will go ahead and delete/overwrite the lock. I guess something caused the overwrite to wait and time out. Not sure what.

rgrinberg commented 1 year ago

I'm not entirely sure. My suspicion is that my folder is also stored on OneDrive.

Okay, that's probably the reason. We should just improve the error message to tell the user the lock file could not be written and we need to retry after deleting it.