Skip to content

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

@leishiao

Description

@leishiao

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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions