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

Infinitely running. #144

Closed
violin0622 opened this issue Nov 3, 2023 · 2 comments
Closed

Infinitely running. #144

violin0622 opened this issue Nov 3, 2023 · 2 comments

Comments

@violin0622
Copy link

Hi, I'm not sure it is a bug, but given the code below ( I know it's a misuse of TcpListener) ,
the sim runs infinitely, and it is expected to stop within 10 logical seconds, and far shorter real world duration.

Maybe it's make sense to add a new simulator config like realworld_duration ?

#[test]
fn infinite() -> turmoil::Result {
    use std::time::SystemTime;
    use turmoil::{net::TcpListener, Builder};

    let mut sim = Builder::new().epoch(SystemTime::UNIX_EPOCH).build();
    sim.host("s", || async {


        loop {
            TcpListener::bind("0.0.0.0:80").await?;
        }
    });

    sim.run()
}

截屏2023-11-03 18 04 54

@mcches
Copy link
Contributor

mcches commented Nov 3, 2023

We've talked about adding an external monitor thread that ensures we don't have runaway tests due to infinite blocking logic. If a real duration elapses we could just panic the test.

There is also some fidelity gaps with bind and send where they actually don't every yield. That might also be something worth looking into, but you could still break it with just a simple infinite busy loop.

@mcches
Copy link
Contributor

mcches commented Jan 4, 2024

Tracking in #160

@mcches mcches closed this as completed Jan 4, 2024
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

2 participants