-
Notifications
You must be signed in to change notification settings - Fork 205
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
Race condition when depending on rules created in post_build. #3168
Comments
I have been looking into the code base to track down this issue, and found that it was actually a race condition. Here is an example build script that will succeed:
Note the |
Here is an example of a BUILD file with a post_build function adding dependencies:
Running this with
plz build //:postRuleConsumer
will result in an output ofcannot calculate hash for plz-out/gen/postFile.txt: file does not exist
.However, if you somehow force
post_func
to run without dependents (in this casepostRuleConsumer
), for example by calling//:postRule
on its own, thenpostFile.txt
will get created.Once the file is created, subsequent runs will start to succeed and have the file available until the next
plz clean
call.What seems to be happening, is that the commands of rules in post_builds aren't getting executed. I have confirmed this by changing the
text_file
rule intogenrule(name="postFile", cmd = "sleep 10; touch postFile.txt", out="postFile.txt")
. When//:postRule
is run on its own, it will take 10 seconds to run, however when run with//:postRuleConsumer
the command will immediately finish, either with the same error, or by succeeding if//:postRule
was run on its own beforehand.The text was updated successfully, but these errors were encountered: