thread 'flexi_logger-flusher' has overflowed its stack
Closed this issue · 2 comments
leishiao commented
When jemallocator::Jemalloc is used as #[global_allocator] and ran with cargo run
, the stacksize 128 of "flexi_logger-flusher" thread seems not enough, reporting thread 'flexi_logger-flusher' has overflowed its stack
error. When ran with cargo run --release
, it does not have this problem.
Here is the code of main.rs :
use std::thread;
use std::time::Duration;
use flexi_logger::{LoggerHandle, WriteMode};
#[global_allocator]
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
fn main() {
let _handle = init_logger();
thread::sleep(Duration::from_secs(1000));
}
pub fn init_logger() -> LoggerHandle {
flexi_logger::Logger::try_with_str("info")
.unwrap()
.log_to_stdout()
.write_mode(WriteMode::BufferAndFlush)
.start()
.unwrap()
}
And this Cargo.toml:
[package]
name = "practice-flexi"
version = "0.1.0"
edition = "2021"
[dependencies]
log = "*"
flexi_logger = { version = "0.19", features = ["async"] }
jemallocator = "*"
This test program is built with rustc 1.57.0-nightly (5b210643e 2021-10-11)
Improving the stacksize to at least 60*1024 on my machine, the problem can be sovled.
leishiao commented
If it is possible to add a specific feature to disable the stacksize limit of flexi_logger-flusher thread.
emabee commented
Version 0.19.5 now has such a feature, dont_minimize_extra_stacks
.