Skip to content

simple logger panics in async/multi-threaded environment possibly due to "local_offset_at" in time-rs dependency #48

@cromulentbanana

Description

@cromulentbanana

First, thanks for your contribution to rust logging!

As of version 1.16, I've oserved that simple logger will panic when executed in the tokio async runtime with the following output:

thread 'main' panicked at 'Could not determine the UTC offset on this system. Possible causes are that the time crate does not implement "local_offset_at" on your system, or that you are running in a multi-threaded environment and the time crate is returning "None" from "local_offset_at" to avoid unsafe behaviour. See the time crate's documentation for more information. (https://time-rs.github.io/internal-api/time/index.html#feature-flags): IndeterminateOffset', /var/home/dlevin/.cargo/registry/src/github.zerozr99.workers.dev-1ecc6299db9ec823/simple_logger-1.16.0/src/lib.rs:409:85
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Panic in Arbiter thread.

I've provided an example repo that you can clone, in which this bug is triggered:

(analytics) ❯❯ git clone [email protected]:cryptobanana/simpleloggerpanic.git
Cloning into 'simpleloggerpanic'...
remote: Enumerating objects: 15, done.
remote: Counting objects: 100% (15/15), done.
remote: Compressing objects: 100% (12/12), done.
remote: Total 15 (delta 0), reused 15 (delta 0), pack-reused 0
Receiving objects: 100% (15/15), 15.29 KiB | 5.10 MiB/s, done.
(analytics) ❯❯ cd simpleloggerpanic
(analytics) ❯❯ cargo run
   Compiling simpleloggerpanic v0.1.0 (/tmp/simpleloggerpanic)
    Finished dev [unoptimized + debuginfo] target(s) in 5.88s
     Running `/home/dlevin/nobackup/cargo/debug/simpleloggerpanic`
2022-01-09 12:23:04,327 INFO [simpleloggerpanic] Logging with level INFO
2022-01-09 12:23:04,327 INFO [actix_server::builder] Starting 8 workers
thread 'main' panicked at 'Could not determine the UTC offset on this system. Possible causes are that the time crate does not implement "local_offset_at" on your system, or that you are running in a multi-threaded environment and the time crate is returning "None" from "local_offset_at" to avoid unsafe behaviour. See the time crate's documentation for more information. (https://time-rs.github.io/internal-api/time/index.html#feature-flags): IndeterminateOffset', /var/home/dlevin/.cargo/registry/src/github.zerozr99.workers.dev-1ecc6299db9ec823/simple_logger-1.16.0/src/lib.rs:409:85
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Panic in Arbiter thread.

I realize this panic is probably not due directly to the simple logger codebase itself, but perhaps if the problem indeed lies in time-rs, then the dependency time-rs can be updated... or something.

Currently simple_logger v1.15 is not affected by this problem.

Many thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    CVE-2020-26235Unsound behaviour with local timezone access

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions