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 - thread 'main' panicked at 'Ratio should be between 0 and 1 inclusively.' #1

Closed
ltrook21 opened this issue Oct 8, 2023 · 14 comments
Assignees
Labels
bug Something isn't working

Comments

@ltrook21
Copy link

ltrook21 commented Oct 8, 2023

Built from source.
Unable to run the program.
thread 'main' panicked at 'Ratio should be between 0 and 1 inclusively.' ..../.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.23.0/src/widgets/gauge.rs:62:9 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

I should probably also note that I'm running this with hybrid graphics enabled, and connected to a power supply.

@alphastrata
Copy link
Owner

Built from source. Unable to run the program. thread 'main' panicked at 'Ratio should be between 0 and 1 inclusively.' ..../.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.23.0/src/widgets/gauge.rs:62:9 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

I should probably also note that I'm running this with hybrid graphics enabled, and connected to a power supply.

@ltrook21 what GPU do you have? do you know the architecture?

@alphastrata
Copy link
Owner

@ltrook21 maybe fix : https://github.com/alphastrata/nvtop/tree/fix/panic-issue%231 much appreciated if you can try.

@alphastrata alphastrata added the bug Something isn't working label Oct 8, 2023
@alphastrata alphastrata self-assigned this Oct 8, 2023
@ltrook21
Copy link
Author

ltrook21 commented Oct 8, 2023

Sure, I'll give it try between tomorrow and Monday. Unfortunately I don't have a lot of time. Also it seems that the link you posted is giving me a 404.

Thanks for the work so far, and being so quick with a response!

@alphastrata
Copy link
Owner

I'm pretty sure some work done this after noon will either of fixed this, or if you pass in the --log <somepath to save your log>.log as an arg it'll tell me exactly what/where something failed.

Lemme know

@ltrook21
Copy link
Author

ltrook21 commented Oct 8, 2023

So I ran it again after pulling the changes, still getting this error:
[2023-10-08][19:53:53][TRACE][nvtop::app][23] crossterm initialisation successful thread 'main' panicked at 'Ratio should be between 0 and 1 inclusively.', /home/rook/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.23.0/src/widgets/gauge.rs:62:9 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

FWIW, I have an Nvidia RTX 3070 TI in a gaming laptop, 2022 release so pretty new hardware.

@alphastrata
Copy link
Owner

So I ran it again after pulling the changes, still getting this error: [2023-10-08][19:53:53][TRACE][nvtop::app][23] crossterm initialisation successful thread 'main' panicked at 'Ratio should be between 0 and 1 inclusively.', /home/rook/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.23.0/src/widgets/gauge.rs:62:9 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

FWIW, I have an Nvidia RTX 3070 TI in a gaming laptop, 2022 release so pretty new hardware.

somewhere the graphs' using the .ratio are getting values they're unable to clamp... weird.
is this off the latest main?

@ltrook21
Copy link
Author

ltrook21 commented Oct 9, 2023

Yep

@alphastrata
Copy link
Owner

Are you able to use nvidia-smi their native tool?

@bktech2021
Copy link
Contributor

bktech2021 commented Oct 9, 2023

#12 this can solve the problem

comment-blocked re-scan beceause discover_gpus not implemented,

also added

let percentage = match avg.is_nan() {
        true => 0.0,
        false => avg
    };
    let label = match avg.is_nan() {
        true => "No fan".to_string(),
        false => format!("{:.1}%", avg)
    };

so if there is no fans, it will show no fans. (i think there can be a more efficient way)

image

@ltrook21
Copy link
Author

So I don't know if this might be helpful at all but nvtop works perfectly on my desktop with an Nvidia RTX 2060. The problem is on my laptop with an RTX 3070 ti...
I will give you an update re. my laptop tomorrow! Thanks!

@bktech2021
Copy link
Contributor

So I don't know if this might be helpful at all but nvtop works perfectly on my desktop with an Nvidia RTX 2060. The problem is on my laptop with an RTX 3070 ti... I will give you an update re. my laptop tomorrow! Thanks!

Because on desktop, your GPU has a fan and it's connected on your GPU card. On the laptop, your mobile GPU doesn't have fans, yes it has fans, but they are connected to your motherboard, like any case fans in your desktop. So, the program doesn't detect it as a GPU fan.

on the program, the fan percentage becomes NaN, and you are clamping it, and becomes NaN, and ratatui says it must be between 0 and 1. and the pull request i made it makes it "If fan spin is NaN, its zero and label is 'No fans'".

i tested it on a GTX1060 6GB and Victus 16 laptop, works fine.

@alphastrata
Copy link
Owner

alphastrata commented Oct 10, 2023

@bktech2021's work (I think) will fix this @ltrook21 -- I just suggested a few changes and we can get it merged in.

alphastrata added a commit that referenced this issue Oct 10, 2023
@ltrook21
Copy link
Author

Awesome. Will give it a shot between tonight and tomorrow so we can close this out.

@ltrook21
Copy link
Author

Sorry, took me a while to try this again.
It's working perfectly fine now! Thanks again for the great work!
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants