Skip to content
This repository has been archived by the owner on Aug 29, 2020. It is now read-only.

attempt to multiply with overflow if swap is disabled #22

Closed
matthiaskrgr opened this issue Jan 23, 2020 · 8 comments
Closed

attempt to multiply with overflow if swap is disabled #22

matthiaskrgr opened this issue Jan 23, 2020 · 8 comments
Labels
bug Something isn't working os:linux

Comments

@matthiaskrgr
Copy link

matthiaskrgr commented Jan 23, 2020

repo @ e56403d
Linux t470 5.4.12-1-MANJARO #1 SMP PREEMPT Wed Jan 15 08:05:08 UTC 2020 x86_64 GNU/Linux
terminal is alacritty

RUST_BACKTRACE=Full ./target/debug/ytop

Backtrace (most recent call first):
  File "/home/matthias/.cargo/git/checkouts/tui-rs-7836e4b22d734056/aff0a4c/src/widgets/canvas/mod.rs", line 106, in tui::widgets::canvas::Context::draw
    let index = dy / 4 * self.width as usize + dx / 2;
  File "/home/matthias/.cargo/git/checkouts/tui-rs-7836e4b22d734056/aff0a4c/src/widgets/chart.rs", line 474, in <tui::widgets::chart::Chart<LX,LY> as tui::widgets::Widget>::draw::{{closure}}
    ctx.draw(&Points {
  File "/home/matthias/.cargo/git/checkouts/tui-rs-7836e4b22d734056/aff0a4c/src/widgets/canvas/mod.rs", line 255, in <tui::widgets::canvas::Canvas<F> as tui::widgets::Widget>::draw
    painter(&mut ctx);
  File "/home/matthias/.cargo/git/checkouts/tui-rs-7836e4b22d734056/aff0a4c/src/widgets/chart.rs", line 469, in <tui::widgets::chart::Chart<LX,LY> as tui::widgets::Widget>::draw
    Canvas::default()
  File "src/widgets/mem.rs", line 96, in <ytop::widgets::mem::MemWidget as tui::widgets::Widget>::draw
    Chart::<String, String>::default()
  File "/home/matthias/.cargo/git/checkouts/tui-rs-7836e4b22d734056/aff0a4c/src/terminal.rs", line 49, in tui::terminal::Frame<B>::render
    widget.draw(area, self.terminal.current_buffer_mut());
  File "/home/matthias/.cargo/git/checkouts/tui-rs-7836e4b22d734056/aff0a4c/src/widgets/mod.rs", line 85, in tui::widgets::Widget::render
    f.render(self, area);
  File "src/draw.rs", line 75, in ytop::draw::draw_middle_row
    widgets.mem.render(frame, horizontal_chunks[1]);
  File "src/draw.rs", line 41, in ytop::draw::draw_widgets
    draw_middle_row(frame, widgets, vertical_chunks[1]);
  File "src/draw.rs", line 22, in ytop::draw::draw::{{closure}}
    draw_widgets(&mut frame, &mut app.widgets, chunks[0]);
  File "/home/matthias/.cargo/git/checkouts/tui-rs-7836e4b22d734056/aff0a4c/src/terminal.rs", line 140, in tui::terminal::Terminal<B>::draw
    f(self.get_frame());
  File "src/draw.rs", line 11, in ytop::draw::draw
    terminal.draw(|mut frame| {
  File "src/main.rs", line 128, in ytop::main
    draw(&mut terminal, &mut app).unwrap();

The application panicked (crashed).
  attempt to multiply with overflow
in /home/matthias/.cargo/git/checkouts/tui-rs-7836e4b22d734056/aff0a4c/src/widgets/canvas/mod.rs, line 106
thread: main
@cjbassi cjbassi added bug Something isn't working os:linux labels Jan 23, 2020
@cjbassi
Copy link
Owner

cjbassi commented Jan 23, 2020

I added some logging in the issue/22 branch. Can you test that out? It should log to ~/.local/state/ytop/errors.log.

@matthiaskrgr
Copy link
Author

matthiaskrgr commented Jan 23, 2020

mmh

[2020-01-24][00:14:39][mio::poll][TRACE]: registering with poller
[2020-01-24][00:14:39][mio::poll][TRACE]: registering with poller
[2020-01-24][00:14:39][ytop::widgets::mem][INFO]: Mem update: main: [(0.0, 0.0), (1.0, 35.79007339477539)]
[2020-01-24][00:14:39][ytop::widgets::mem][INFO]: Mem update: swap: [(0.0, 0.0), (1.0, NaN)]
[2020-01-24][00:14:39][ytop::widgets::mem][INFO]: Mem draw: main: [(0.0, 0.0), (1.0, 35.79007339477539)]
[2020-01-24][00:14:39][ytop::widgets::mem][INFO]: Mem draw: swap: [(0.0, 0.0), (1.0, NaN)]

It's probably not expecting that I disabled swap using swapoff 😅 (swapoff -a)

@cjbassi
Copy link
Owner

cjbassi commented Jan 23, 2020

hah yah that might be it. Let me play around with rust-psutil to try and fix it.

@cjbassi
Copy link
Owner

cjbassi commented Jan 23, 2020

Can you paste the output of /proc/meminfo?

@matthiaskrgr
Copy link
Author

MemTotal:       16055848 kB
MemFree:         2479568 kB
MemAvailable:   10417612 kB
Buffers:              12 kB
Cached:          8153928 kB
SwapCached:            0 kB
Active:         10012856 kB
Inactive:        2350192 kB
Active(anon):    4510676 kB
Inactive(anon):   172888 kB
Active(file):    5502180 kB
Inactive(file):  2177304 kB
Unevictable:      291828 kB
Mlocked:              64 kB
SwapTotal:             0 kB
SwapFree:              0 kB
Dirty:            111556 kB
Writeback:             0 kB
AnonPages:       4500964 kB
Mapped:           461728 kB
Shmem:            474456 kB
KReclaimable:     598812 kB
Slab:             773340 kB
SReclaimable:     598812 kB
SUnreclaim:       174528 kB
KernelStack:       13984 kB
PageTables:        35292 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     8027924 kB
Committed_AS:   10209484 kB
VmallocTotal:   34359738367 kB
VmallocUsed:       32632 kB
VmallocChunk:          0 kB
Percpu:             2560 kB
HardwareCorrupted:     0 kB
AnonHugePages:         0 kB
ShmemHugePages:        0 kB
ShmemPmdMapped:        0 kB
FileHugePages:         0 kB
FilePmdMapped:         0 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
Hugetlb:               0 kB
DirectMap4k:     4628232 kB
DirectMap2M:    11800576 kB
DirectMap1G:     1048576 kB

@matthiaskrgr matthiaskrgr changed the title panic on startup: attempt to multiply with overflow attempt to multiply with overflow if swap is disabled Jan 23, 2020
@matthiaskrgr
Copy link
Author

For the record I can confirm that the problem no longer occurs if I reenable the swap!

@cjbassi
Copy link
Owner

cjbassi commented Jan 23, 2020

Just pushed a fix to master, can you test it?

@matthiaskrgr
Copy link
Author

It works now, thanks! :D

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

No branches or pull requests

2 participants