Skip to content

Commit 31cd0ab

Browse files
authored
fix(tauri): disable GPU compositing on Intel macOS to prevent SIGABRT crash (tinyhumansai#1315)
1 parent 4e9f2a8 commit 31cd0ab

1 file changed

Lines changed: 53 additions & 0 deletions

File tree

app/src-tauri/src/lib.rs

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,6 +1098,17 @@ pub fn run() {
10981098
sample_rate: 1.0,
10991099
..sentry::ClientOptions::default()
11001100
});
1101+
// Tag every Sentry event with CPU architecture and OS so Intel-specific
1102+
// crashes (issue #1012 — SIGABRT in CrBrowserMain on x86_64 macOS) are
1103+
// clearly identified without needing a separate build identifier.
1104+
sentry::configure_scope(|scope| {
1105+
scope.set_tag("cpu_arch", std::env::consts::ARCH);
1106+
scope.set_tag("os_name", std::env::consts::OS);
1107+
#[cfg(target_os = "macos")]
1108+
if let Some(ver) = macos_os_version() {
1109+
scope.set_tag("os_version", ver);
1110+
}
1111+
});
11011112

11021113
// Optional smoke trigger for verifying the Sentry pipeline end-to-end.
11031114
// Run with `OPENHUMAN_TAURI_SENTRY_TEST=panic` to fire a panic, or
@@ -1128,6 +1139,19 @@ pub fn run() {
11281139
// replacing the previous stderr-only `env_logger`.
11291140
file_logging::init();
11301141

1142+
// Log platform identity early so every log session is tagged with arch
1143+
// and OS version — essential for reproducing and triaging Intel-only
1144+
// crashes like issue #1012 (SIGABRT in CrBrowserMain on x86_64 macOS).
1145+
{
1146+
let arch = std::env::consts::ARCH;
1147+
let os = std::env::consts::OS;
1148+
#[cfg(target_os = "macos")]
1149+
let os_ver = macos_os_version().unwrap_or_else(|| "unknown".to_string());
1150+
#[cfg(not(target_os = "macos"))]
1151+
let os_ver = "n/a".to_string();
1152+
log::info!("[startup] platform: arch={arch} os={os} os_version={os_ver}");
1153+
}
1154+
11311155
// The vendored tauri-cef dev-server proxy builds a reqwest 0.13 client
11321156
// (see vendor/tauri-cef/crates/tauri/src/protocol/tauri.rs) which calls
11331157
// rustls 0.23's `CryptoProvider::get_default()`. rustls 0.23 no longer
@@ -1213,6 +1237,18 @@ pub fn run() {
12131237
// `about:blank` (blank panel for Telegram / WhatsApp / Slack / Discord).
12141238
// Same port the `cdp::CDP_HOST`/`cdp::CDP_PORT` constants expect.
12151239
args.push(("--remote-debugging-port", Some("19222")));
1240+
// Issue #1012 — Intel macOS (x86_64) crashes with EXC_CRASH (SIGABRT)
1241+
// inside CrBrowserMain when CEF 146 tries to use GPU compositing via
1242+
// Metal on Intel GPU hardware/drivers. Disable GPU compositing on
1243+
// x86_64 macOS so the browser process falls back to software
1244+
// compositing instead of aborting. This flag is a no-op on Apple
1245+
// Silicon (arm64) and on non-macOS targets; all other GPU paths
1246+
// (WebGL, video decode) remain unaffected.
1247+
#[cfg(all(target_os = "macos", target_arch = "x86_64"))]
1248+
{
1249+
args.push(("--disable-gpu-compositing", None));
1250+
log::info!("[cef-startup] Intel macOS detected: adding --disable-gpu-compositing (issue #1012)");
1251+
}
12161252
tauri::Builder::<tauri::Cef>::new().command_line_args::<&str, &str>(args)
12171253
};
12181254

@@ -1786,6 +1822,23 @@ fn resolve_sentry_environment() -> String {
17861822
"production".to_string()
17871823
}
17881824

1825+
/// Returns the macOS product version string (e.g. `"14.5"`) by reading
1826+
/// `sw_vers -productVersion`. Returns `None` on non-macOS targets or when
1827+
/// the command is unavailable. Used to tag Sentry events and startup logs
1828+
/// with OS version so Intel-specific crashes (issue #1012) can be filtered
1829+
/// by macOS release.
1830+
#[cfg(target_os = "macos")]
1831+
fn macos_os_version() -> Option<String> {
1832+
std::process::Command::new("sw_vers")
1833+
.arg("-productVersion")
1834+
.output()
1835+
.ok()
1836+
.filter(|o| o.status.success())
1837+
.and_then(|o| String::from_utf8(o.stdout).ok())
1838+
.map(|s| s.trim().to_string())
1839+
.filter(|s| !s.is_empty())
1840+
}
1841+
17891842
#[cfg(test)]
17901843
mod tests {
17911844
use super::*;

0 commit comments

Comments
 (0)