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

scx_utils: Add retryable errors #549

Merged
merged 1 commit into from
Aug 25, 2024
Merged

Conversation

hodgesds
Copy link
Contributor

Automatically (try to) create the socket dir if it doesn't exist. Sometimes the server will fail with:

$ sudo ./target/release/scx_layered --run-example --stats 5
thread '<unnamed>' panicked at src/main.rs:1960:74:
called `Result::unwrap()` on an `Err` value: No such file or directory (os error 2)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
21:52:54 [INFO] CPUs: online/possible=16/16 nr_cores=8
21:52:54 [INFO] configuring node 0, LLCs 2
21:52:54 [INFO] configuring llc 0 for node 0
21:52:54 [INFO] configuring llc 1 for node 0
21:52:55 [INFO] Layered Scheduler Attached. Run `scx_layered --monitor` for metrics.
^CEXIT: unregistered from user space

@hodgesds hodgesds requested a review from htejun August 24, 2024 21:54
@htejun
Copy link
Contributor

htejun commented Aug 25, 2024

So, in launch(), there's this:

        if let Some(dir) = path.parent() {
            std::fs::create_dir_all(dir).with_context(|| format!("creating {:?}", dir))?;
        }

Shouldn't this be enough? It's doing create_dir_all() on the parent. If you can reproduce the problem, can you find out why that's not working?

@hodgesds
Copy link
Contributor Author

hodgesds commented Aug 25, 2024

I think I see the problem in scx_layered, during startup the monitor is called before the launch() is called during the scheduler init. To reproduce I run rm -rf /var/run/scx && scx_layered --run-example --stats 1.

@hodgesds hodgesds force-pushed the stats-path-fix branch 4 times, most recently from dbb09de to 8b599ae Compare August 25, 2024 14:58
@hodgesds hodgesds changed the title scx_stats: Create socket dir automatically scx_utils: Add retryable errors Aug 25, 2024
@hodgesds
Copy link
Contributor Author

Updated by adding more retryable errors. In the case where the server hadn't started the path wouldn't be found so the stats server connection would never happen.

std::io::ErrorKind::NotFound,
std::io::ErrorKind::ConnectionRefused,
].to_vec();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With const array like:

    const RETRYABLE_ERRORS: [std::io::ErrorKind; 2] = [
        std::io::ErrorKind::NotFound,
        std::io::ErrorKind::ConnectionRefused,
    ];

this doesn't have to be global and moved into monitor_stats().

@htejun
Copy link
Contributor

htejun commented Aug 25, 2024

Ah, that makes sense. Thanks for debugging it.

Add a set of retryable errors for scx_utils when connecting to the stats
server.

Signed-off-by: Daniel Hodges <[email protected]>
@hodgesds hodgesds merged commit bf67b83 into sched-ext:main Aug 25, 2024
2 checks passed
@hodgesds hodgesds deleted the stats-path-fix branch August 25, 2024 19:22
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

Successfully merging this pull request may close these issues.

2 participants