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

Panic occurs when access lazy_static! at the end of thread #152

Open
quininer opened this issue Jun 24, 2020 · 0 comments
Open

Panic occurs when access lazy_static! at the end of thread #152

quininer opened this issue Jun 24, 2020 · 0 comments

Comments

@quininer
Copy link
Member

loom::lazy_static!{
    static ref ID: usize = 0x42;
}

loom::thread_local!{
    static BAR: Bar = Bar;
}

struct Bar;

impl Drop for Bar {
    fn drop(&mut self) {
        let _ = &*ID;
    }
}

fn main() {
    loom::model(|| {
        BAR.with(|_| ());
    });
}

output:

thread 'main' panicked at 'attempted to access lazy_static during shutdown', /loom-0.3.4/src/rt/lazy_static.rs:43:9

Maybe we should be ensured that drop of lazy_static! occurs after thread_local!.

Pointerbender added a commit to Pointerbender/loom that referenced this issue Dec 7, 2022
- ensure that global statics are dropped after thread locals
- ensure that `loom` does not panic inside a panic
- add two regression tests for tokio-rs#152
adrianheine pushed a commit to adrianheine/loom that referenced this issue Mar 10, 2023
- ensure that global statics are dropped after thread locals
- ensure that `loom` does not panic inside a panic
- add two regression tests for tokio-rs#152
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant