Skip to content

Commit

Permalink
Remove concurrent commands warning
Browse files Browse the repository at this point in the history
Summary: Concurrent commands should be safe now that we have DICE locking in place. Note that I won't land this until whatsapp/fbsource are using buckconfigs

Reviewed By: ndmitchell, krallin

Differential Revision: D39739920

fbshipit-source-id: cbe7feea5f5175fcf7482ff17250e20b5180d1ce
  • Loading branch information
wendy728 authored and facebook-github-bot committed Sep 29, 2022
1 parent 7a8d816 commit ae3c74d
Showing 1 changed file with 0 additions and 34 deletions.
34 changes: 0 additions & 34 deletions buck2_server/src/active_commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
use std::collections::HashSet;
use std::sync::Mutex;

use buck2_core::env_helper::EnvHelper;
use buck2_events::trace::TraceId;
use gazebo::dupe::Dupe;
use itertools::Itertools;
use once_cell::sync::Lazy;

static ACTIVE_COMMANDS: Lazy<Mutex<HashSet<TraceId>>> = Lazy::new(|| Mutex::new(HashSet::new()));
Expand All @@ -30,37 +27,6 @@ pub struct ActiveCommandDropGuard {

impl ActiveCommandDropGuard {
pub fn new(trace_id: TraceId) -> Self {
let result = {
// Scope the guard so it's locked as little as possible
let mut active_commands = ACTIVE_COMMANDS.lock().unwrap();
active_commands.insert(trace_id.dupe());

if active_commands.len() > 1 {
Some(active_commands.clone())
} else {
None
}
};

if let Some(commands) = result {
static ERROR_CONCURRENT: EnvHelper<bool> = EnvHelper::new("BUCK2_ERROR_CONCURRENT");

let message = format!(
"Warning! Concurrent commands detected! Concurrent commands are not supported and likely results in crashes and incorrect builds.\n Currently running commands are `{}`",
commands
.iter()
.map(|id| format!("https://www.internalfb.com/buck2/{}", id))
.join(" ")
);

if ERROR_CONCURRENT.get_copied().ok() == Some(Some(true)) {
panic!("{}", message);
} else {
// we use eprintln here on purpose so that this message goes to ALL commands, since
// concurrent commands can affect correctness of ALL commands.
eprintln!("{}", message);
}
}
Self { trace_id }
}
}
Expand Down

0 comments on commit ae3c74d

Please sign in to comment.