Don't generate crash reports on the Dev channel (#35915)

We only want minidumps to be generated on actual release builds. Now we
avoid spawning crash handler processes for dev builds. To test
minidumping you can still set the `ZED_GENERATE_MINIDUMPS` env var which
force-enable the feature.

Release Notes:

- N/A
This commit is contained in:
Julia Ryan 2025-08-09 06:42:30 -05:00 committed by GitHub
parent 7862c0c945
commit 021681d456
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 14 additions and 1 deletions

1
Cargo.lock generated
View file

@ -4014,6 +4014,7 @@ dependencies = [
"log", "log",
"minidumper", "minidumper",
"paths", "paths",
"release_channel",
"smol", "smol",
"workspace-hack", "workspace-hack",
] ]

View file

@ -10,6 +10,7 @@ crash-handler.workspace = true
log.workspace = true log.workspace = true
minidumper.workspace = true minidumper.workspace = true
paths.workspace = true paths.workspace = true
release_channel.workspace = true
smol.workspace = true smol.workspace = true
workspace-hack.workspace = true workspace-hack.workspace = true

View file

@ -1,6 +1,7 @@
use crash_handler::CrashHandler; use crash_handler::CrashHandler;
use log::info; use log::info;
use minidumper::{Client, LoopAction, MinidumpBinary}; use minidumper::{Client, LoopAction, MinidumpBinary};
use release_channel::{RELEASE_CHANNEL, ReleaseChannel};
use std::{ use std::{
env, env,
@ -9,7 +10,7 @@ use std::{
path::{Path, PathBuf}, path::{Path, PathBuf},
process::{self, Command}, process::{self, Command},
sync::{ sync::{
OnceLock, LazyLock, OnceLock,
atomic::{AtomicBool, Ordering}, atomic::{AtomicBool, Ordering},
}, },
thread, thread,
@ -22,7 +23,14 @@ pub static CRASH_HANDLER: AtomicBool = AtomicBool::new(false);
pub static REQUESTED_MINIDUMP: AtomicBool = AtomicBool::new(false); pub static REQUESTED_MINIDUMP: AtomicBool = AtomicBool::new(false);
const CRASH_HANDLER_TIMEOUT: Duration = Duration::from_secs(60); const CRASH_HANDLER_TIMEOUT: Duration = Duration::from_secs(60);
pub static GENERATE_MINIDUMPS: LazyLock<bool> = LazyLock::new(|| {
*RELEASE_CHANNEL != ReleaseChannel::Dev || env::var("ZED_GENERATE_MINIDUMPS").is_ok()
});
pub async fn init(id: String) { pub async fn init(id: String) {
if !*GENERATE_MINIDUMPS {
return;
}
let exe = env::current_exe().expect("unable to find ourselves"); let exe = env::current_exe().expect("unable to find ourselves");
let zed_pid = process::id(); let zed_pid = process::id();
// TODO: we should be able to get away with using 1 crash-handler process per machine, // TODO: we should be able to get away with using 1 crash-handler process per machine,
@ -138,6 +146,9 @@ impl minidumper::ServerHandler for CrashServer {
} }
pub fn handle_panic() { pub fn handle_panic() {
if !*GENERATE_MINIDUMPS {
return;
}
// wait 500ms for the crash handler process to start up // wait 500ms for the crash handler process to start up
// if it's still not there just write panic info and no minidump // if it's still not there just write panic info and no minidump
let retry_frequency = Duration::from_millis(100); let retry_frequency = Duration::from_millis(100);