Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

thread 'flexi_logger-flusher' has overflowed its stack #95

Closed
leishiao opened this issue Oct 12, 2021 · 2 comments
Closed

thread 'flexi_logger-flusher' has overflowed its stack #95

leishiao opened this issue Oct 12, 2021 · 2 comments

Comments

@leishiao
Copy link

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
Copy link
Author

If it is possible to add a specific feature to disable the stacksize limit of flexi_logger-flusher thread.

@emabee
Copy link
Owner

emabee commented Oct 19, 2021

Version 0.19.5 now has such a feature, dont_minimize_extra_stacks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants