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

"index out of bounds", when cycling past the outer columns #96

Open
pflakus opened this issue Feb 15, 2021 · 17 comments
Open

"index out of bounds", when cycling past the outer columns #96

pflakus opened this issue Feb 15, 2021 · 17 comments
Assignees
Labels
bug Something isn't working

Comments

@pflakus
Copy link

pflakus commented Feb 15, 2021

When I press . or , in the task panel, to move the selected column past the first/last column, the application fails with the following "index out of bounds"-message:

$ zenith
thread '<unnamed>' panicked at 'index out of bounds: the len is 12 but the index is 13', src/render.rs:314:5

The issue can be reproduced consistently.
I'm running zenith 0.12.0, from the "zenith-bin" AUR package.

@bvaisvil bvaisvil self-assigned this Feb 15, 2021
@bvaisvil
Copy link
Owner

Thanks for reporting!

@bvaisvil bvaisvil added the bug Something isn't working label Feb 24, 2021
@bvaisvil
Copy link
Owner

Unable to replicate on my end as of yet. Are you running with nvidia/graphics support?

@pflakus
Copy link
Author

pflakus commented Feb 24, 2021

Without, I don't have the optional "nvidia-tools" installed.

To be clear, I was just trying this tool out for fun, to compare Rust-based tool alternatives. But I moved on in the meantime. (No hard feelings, I hope... ;) ) I reported it hoping that it would be helpful to you.
So if this bug doesn't impact more users, feel free to deprioritize this issue...

But for reference, I just did another clean install (without nvidia support) and was able to reproduce the same behavior instantly.

@bvaisvil
Copy link
Owner

bvaisvil commented Feb 24, 2021

Thanks for getting back to me. And no, no hard feelings :). I appreciate you took to the time to make an issue and for trying another install!

@murlakatamenka
Copy link

Hey, I can reproduce the issue. No nvidia GPU here.

zenith panics if you jump

  1. beyond rightmost column with .:
thread '<unnamed>' panicked at 'index out of bounds: the len is 12 but the index is 12', src/render.rs:314:5
  1. beyond leftmost column with ,:
thread '<unnamed>' panicked at 'index out of bounds: the len is 12 but the index is 13', src/render.rs:314:5

(I'm the maintainer of the aforementioned AUR zenith-bin package btw 😄 and also have it installed)

@bvaisvil
Copy link
Owner

Thanks for letting me know. What version are you running ?

@murlakatamenka
Copy link

@bvaisvil
Copy link
Owner

Possible for you to try building it from source (master branch) and see if it still happens for you?

@murlakatamenka
Copy link

It cycles as expected with current master 6f09825

@bvaisvil
Copy link
Owner

great! Thank you for testing and letting me know. I'll work on making a new release.

@murlakatamenka
Copy link

I maintain AUR's zenith and zenith-bin packages and found something interesting:

zenith 0.13 complied from sources doesn't have this OOB panic, but binary from .deb release does.

image

@bvaisvil
Copy link
Owner

@murlakatamenka Thanks for reporting! I'll take a look.

@bvaisvil
Copy link
Owner

Does it panic instantly, or only while cycling? If it panics while you're cycling the table, could you tell me what columns you have?

@bvaisvil
Copy link
Owner

Okay, I think I've figured this out. The deb package is built on a docker image with the nvidia drivers installed. So the deb binary is linked against that. zenith checks if any nvidia devices are present before rendering the process table and removes the columns. Since the number of columns is determined at compile time and the excision is at runtime, this leads to a problem on running with --features nvidia on a system either without the nvidia driver or with the driver with no video card.

So I think at least three things need to be done -

  1. zenith should not crash when being run on a system either without the card or the driver. For the moment this means presenting unused graphics columns on systems without the card or driver.
  2. Create two deb packages one with nvidia support and one without.
  3. Update zenith to make decisions about columns in the process table at runtime. This also allow users to select which columns to show/hide.

bvaisvil added a commit that referenced this issue Mar 11, 2022
@bvaisvil
Copy link
Owner

I've made a new deb package that contains the fixes in commit 897364e. In my testing this fixed the issue. Would very much appreciate it if you could give it a try and see if it works for you.

New Deb file:
zenith_0.13.0-1_amd64.deb.zip

@murlakatamenka
Copy link

Does it panic instantly, or only while cycling? If it panics while you're cycling the table, could you tell me what columns you have?

Yes, it was only when cycling.

image


Your guess should be right because I don't run Nvidia GPU and don't have its drivers installed. The binary from attached .deb works without panicking 👍

As a side note it still shows an empty "Graphics" group, it takes space for no reason.

@bvaisvil
Copy link
Owner

As a side note it still shows an empty "Graphics" group, it takes space for no reason.

Updated to hide the 'Graphics' group to hide if no cards are detected. Could you try this and check to see if that works and if it still doesn't crash. Thanks!

zenith_0.13.0-1_amd64.deb.zip

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