anoma / juvix

A language for intent-centric and declarative decentralised applications
https://docs.juvix.org
GNU General Public License v3.0
448 stars 54 forks source link

Build directory data race when using `juvix format` #2878

Open paulcadman opened 2 months ago

paulcadman commented 2 months ago

To reproduce:

  1. Clone juvix-stdlib
git clone https://github.com/anoma/juvix-stdlib
  1. Run juvix format in the test directory
cd juvix-stdlib
juvix format test/

Expected

The juvix-stdlib-test project is formatted

Actual

An error is produced due to two juvix processes trying to modify the same file simultaneously.

Example error:

juvix: /private/tmp/juvix-stdlib/test/.juvix-build/private/tmp/juvix-stdlib/test/.juvix-build/deps/5aaa604f79e70669ec155cd8e5f57d0fdc9532adb5a0ebaeaa0b7eec5fd77d52/Stdlib/Trait/Ord.jvo: withBinaryFile: resource busy (file is locked)

Workaround

Run juvix with the number of threads set to 1:

juvix -N1 format test
paulcadman commented 2 months ago

Project locking is necessary if we allow concurrent access to the build directory: https://github.com/anoma/juvix/issues/2812