Closed nickgerace closed 1 year ago
It's generally expected that you'd use isolation directories for concurrent builds. At least for LSPs at fb, isolation directories are used to prevent LSP-spawned processes from clobbering terminal-spawned process and vice-versa.
(Speaking only as a user of Buck2, not as a member of the team, I'd love to have more fine-grained locking inside of Buck2, but I understand that it might be very tricky to implement.)
I think this is a slightly different thing? The buck2 daemon for me seems to do this correctly - if I run 5 different run targets in quick succession, which have overlapping build requirements, the daemon knows that it should wait on another concurrent build to make progress. We see this behavior consistently for roughly half of our team.
For the other half, they consistently just get build failures (that, indeed, look like isolation issues.) But it feels like this is one of the primary use cases for buck2 - being able to have the build daemon and the more granular build graph handle this kind of optimization. Certainly for those of us who have it working, it is, as the kids say, super sweet. So the issue does feel somehow more fundamental.
@davidbarsky also, it makes sense that the LSP would want a separate isolation directory, because you don't want your editor to ever block another build. This is a slightly different problem. :)
Adding onto what @adamhjk said: in his terminal panes, there are logs containing waiting on another command task
(or similar wording, cannot recall precisely). In my terminal panes, I don't see those logs at all, and each buck2
invocation appears to just continue as if they were building in isolation.
@adamhjk Yup, it probably is: I ran this by Wendy—I don't think she's on GitHub—and she said that she suspects that "the buckconfigs for controlling concurrent command behavior is not enabled".
(I'm not sure how to enable it, as I unknowingly messaged her while she was on a road trip.)
Cool! we can dig around. I think it's related to this FAQ entry not quite doing what we expect:
https://buck2.build/docs/faq/common_issues/#are-multiple-concurrent-commands-supported
Doesn't seem to be a documented config option that turns this behavior on or off.
I'm guessing you want this
In app/buck2_server/src/daemon/state.rs
there's this code that should control it
let nested_invocation_config = root_config
.parse::<NestedInvocation>("buck2", "nested_invocation")?
.unwrap_or(NestedInvocation::Run);
let parallel_invocation_config = root_config
.parse::<ParallelInvocation>("buck2", "parallel_invocation")?
.unwrap_or(ParallelInvocation::Run);
Used in .buckconfig
as
[buck2]
/// other keys
parallel_invocation = run | block | error
nested_invocation = run | error
We really should flip the default for this to have the "correct" behavior. I'll send a diff for it.
On Mon, Jun 5, 2023 at 7:45 AM Thomas Orozco @.***> wrote:
We really should flip the default for this to have the "correct" behavior. I'll send a diff for it
Isn’t the default “run” tho, which is the correct behavior?
Isn’t the default “run” tho, which is the correct behavior?
The default is run, but to get correct behavior, you'd need:
[buck2]
parallel_invocation = block
nested_invocation = error
dice_cleanup = block
Thank you @krallin! Haven't tried it yet, but I will soon.
Description
When running two top-level targets that have overlapping third party Rust crate dependencies with targets generated by reindeer, cascading build failures will occur.
Reproduction
This can be reproduced when they’re run at the same time in two different terminals. First, create two Rust binaries that depend on at least one of the same third party Rust crates (let's call them
foo
andbar
). Then, vendor the third party rust crates with reindeer and then run each target in two different terminals.One terminal:
Another terminal:
You will see multiple errors in each terminal.
Here's an example from the first terminal:
Here's an example from the second terminal:
Additional Thoughts
As an aside, thanks for this great project!