mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-20 03:22:18 +00:00
fix(runtime): update codec and debug stack headroom (#5164)
* fix(runtime): raise debug worker stack headroom Co-Authored-By: heihutu <heihutu@gmail.com> * chore(deps): update codec to 8.0.2 Co-Authored-By: heihutu <heihutu@gmail.com> --------- Co-authored-by: heihutu <heihutu@gmail.com>
This commit is contained in:
Generated
+2
-2
@@ -9200,9 +9200,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustfs-erasure-codec"
|
name = "rustfs-erasure-codec"
|
||||||
version = "8.0.1"
|
version = "8.0.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a39413e8f0ca32be9bc2ca9d29f8d17a2ddf952748284cf0fd148ab11180cf6c"
|
checksum = "bb8ba5edcc507013a0a7bcf7424be94f0ef070b38eab8bcbc38206a8148bc70a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
"cfg_aliases",
|
"cfg_aliases",
|
||||||
|
|||||||
+1
-1
@@ -278,7 +278,7 @@ pretty_assertions = "1.4.1"
|
|||||||
rand = { version = "0.10.2" }
|
rand = { version = "0.10.2" }
|
||||||
ratelimit = "0.10.1"
|
ratelimit = "0.10.1"
|
||||||
rayon = "1.12.0"
|
rayon = "1.12.0"
|
||||||
reed-solomon-erasure = { package = "rustfs-erasure-codec", version = "8.0.1" }
|
reed-solomon-erasure = { package = "rustfs-erasure-codec", version = "8.0.2" }
|
||||||
reed-solomon-simd = "3.1.0"
|
reed-solomon-simd = "3.1.0"
|
||||||
regex = { version = "1.13.1" }
|
regex = { version = "1.13.1" }
|
||||||
rumqttc = { package = "rumqttc-next", version = "0.33.3" }
|
rumqttc = { package = "rumqttc-next", version = "0.33.3" }
|
||||||
|
|||||||
@@ -19,15 +19,37 @@ use rustfs_obs::dial9::Dial9SessionGuard;
|
|||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn compute_default_thread_stack_size() -> usize {
|
fn compute_default_thread_stack_size() -> usize {
|
||||||
// Baseline: Release 1 MiB,Debug 2 MiB;macOS at least 2 MiB
|
if cfg!(debug_assertions) {
|
||||||
// macOS is more conservative: many system libraries and backtracking are more "stack-eating"
|
// Debug builds keep larger async futures and tracing state on the stack;
|
||||||
if cfg!(debug_assertions) || cfg!(target_os = "macos") {
|
// scanner e2e paths need more headroom than the release runtime.
|
||||||
|
8 * rustfs_config::DEFAULT_THREAD_STACK_SIZE
|
||||||
|
} else if cfg!(target_os = "macos") {
|
||||||
|
// macOS is more conservative: many system libraries and backtracking are more "stack-eating"
|
||||||
2 * rustfs_config::DEFAULT_THREAD_STACK_SIZE
|
2 * rustfs_config::DEFAULT_THREAD_STACK_SIZE
|
||||||
} else {
|
} else {
|
||||||
rustfs_config::DEFAULT_THREAD_STACK_SIZE
|
rustfs_config::DEFAULT_THREAD_STACK_SIZE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn default_thread_stack_size_matches_build_profile() {
|
||||||
|
let default_stack = rustfs_config::DEFAULT_THREAD_STACK_SIZE;
|
||||||
|
let expected = if cfg!(debug_assertions) {
|
||||||
|
8 * default_stack
|
||||||
|
} else if cfg!(target_os = "macos") {
|
||||||
|
2 * default_stack
|
||||||
|
} else {
|
||||||
|
default_stack
|
||||||
|
};
|
||||||
|
|
||||||
|
assert_eq!(compute_default_thread_stack_size(), expected);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn detect_cores() -> usize {
|
fn detect_cores() -> usize {
|
||||||
// Priority physical cores, fallback logic cores, minimum 1
|
// Priority physical cores, fallback logic cores, minimum 1
|
||||||
|
|||||||
Reference in New Issue
Block a user