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

[BUG] ERROR: Exception in runner thread #9

Closed
tmnhy opened this issue Sep 20, 2021 · 15 comments
Closed

[BUG] ERROR: Exception in runner thread #9

tmnhy opened this issue Sep 20, 2021 · 15 comments
Assignees
Labels
bug Something isn't working

Comments

@tmnhy
Copy link

tmnhy commented Sep 20, 2021

Describe the bug

ERROR: Exception in runner thread -> Proc:: -> array::at: __n (which is 18446744071562068066) >= _Nm (which is 101)

To Reproduce

Run btop and wait

Expected behavior

Handling an exception with code

Screenshots

Info (please complete the following information):

  • btop++ version: btop version: 1.0.1
  • Architecture: [x86_64, aarch64, etc.] x86_64
  • Platform: Linux
  • (Linux) Kernel: 5.14.1
  • (OSX/FreeBSD) Os release version:
  • Terminal used: Konsole
  • Font used: terminus

Additional context

contents of ~/.config/btop/error.log: empty

contents of ~/.config/btop/btop.log:

2021/09/20 (11:20:41) | ===> btop++ v.1.0.1
2021/09/20 (11:20:41) | ERROR: Exception in runner thread -> Proc:: -> array::at: __n (which is 18446744071562068063) >= _Nm (which is 101)

2021/09/20 (11:39:42) | ===> btop++ v.1.0.1
2021/09/20 (11:39:42) | ERROR: Exception in runner thread -> Proc:: -> array::at: __n (which is 18446744071562068063) >= _Nm (which is 101)

2021/09/20 (12:29:13) | ===> btop++ v.1.0.1
2021/09/20 (12:29:13) | ERROR: Exception in runner thread -> Proc:: -> array::at: __n (which is 18446744071562068066) >= _Nm (which is 101)

2021/09/20 (15:19:59) | ===> btop++ v.1.0.1
2021/09/20 (15:19:59) | ERROR: Exception in runner thread -> Proc:: -> array::at: __n (which is 18446744071562068066) >= _Nm (which is 101)

2021/09/20 (15:32:25) | ===> btop++ v.1.0.1
2021/09/20 (15:32:25) | DEBUG: Starting in DEBUG mode!
2021/09/20 (15:32:25) | INFO: Logger set to DEBUG
2021/09/20 (15:32:25) | DEBUG: Setting LC_ALL=ru_RU.utf8
2021/09/20 (15:32:25) | INFO: Running on /dev/pts/4
2021/09/20 (17:36:35) | ERROR: Exception in runner thread -> Proc:: -> array::at: __n (which is 18446744071562068068) >= _Nm (which is 101)
2021/09/20 (17:36:35) | INFO: Quitting! Runtime: 02:04:10
@tmnhy tmnhy added the bug Something isn't working label Sep 20, 2021
@aristocratos
Copy link
Owner

@tmnhy

Expected behavior
Handling an exception with code

This exception was handled by code, by showing where the exception happened and what happened and then exiting. No handling would mean no message and a segmentation fault.

Need some more information however:
Does this happen randomly or when you do a specific action?
Do you have the options for proc set to default and if not, what values are set?

@aristocratos
Copy link
Owner

aristocratos commented Sep 20, 2021

@tmnhy
This should be fixed in release 1.0.2

But the root cause of your issue looks like a underflow of a unsigned long long, and I'm not quite sure where or why it's happening. But it shouldn't crash in latest release after clamping the value to the size of the array it's accessing.

But please let me know if you notice any CPU percent values looking wrong because that would likely be because of this.

@tmnhy tmnhy changed the title [BUG] [BUG] ERROR: Exception in runner thread Sep 20, 2021
@tmnhy
Copy link
Author

tmnhy commented Sep 20, 2021

Thx I'll be watching

@nulopes
Copy link

nulopes commented Sep 21, 2021

Hi, this has happened to me with version 1.0.2 just now. One of the times I wasn't in front of the computer, the other time I launched btop and it crashed with that error in a few seconds.
I haven't changed any settings and the percentages seem right (at least when I'm watching)

If I can do anything more to help, please tell me and I'll do it.

@tmnhy
Copy link
Author

tmnhy commented Sep 21, 2021

1.0.2 did not solve the problem

@aristocratos
Copy link
Owner

aristocratos commented Sep 21, 2021

@tmnhy @nulopes
Pushed some possible fixes in latest commit that you can try. If you need the precompiled static binaries, you're gonna have to wait a bit.

New binaries available in release v1.0.3

@tmnhy
Copy link
Author

tmnhy commented Sep 21, 2021

Thx no exception from the version v1.0.3
But strange memory figures, e.g. firefox. bpytop at the same time shows real data (near 200M)
image

@aristocratos
Copy link
Owner

@tmnhy
Are all the memory values off or is some correct?

Could you post the output from some of the wrong ones with: cat /proc/<pid>/stat

@tmnhy
Copy link
Author

tmnhy commented Sep 21, 2021

Now only firefox.

E.g. for PID 27129:

  • btop - 9T
  • bpytop - 165M
  • htop - RES column - 165M

/proc/27129/stat:
27129 (Isolated Web Co) S 10909 10731 10731 0 -1 4210944 18364 0 51 0 118 21 0 0 20 0 29 0 2959205 2657251328 42370 18446744073709551615 94695736011472 94695736682384 140726568493696 0 0 0 0 69634 1082133752 0 0 0 17 14 0 0 0 0 0 94695736695120 94695736696376 94695766564864 140726568501365 140726568501558 140726568501558 140726568505311 0

@aristocratos
Copy link
Owner

@tmnhy
Wow, your stat file is reporting 18446744073709551615 RSS in pages (field 24). That is then in turn multiplied by your page size, usually 4096 (bytes) which overflows the variable and comes back around from 0 to the value you get.

What values do you get from
cat /proc/<pid>/statm and cat /proc/<pid>/status for the same PID.

@tmnhy
Copy link
Author

tmnhy commented Sep 21, 2021

I have reboot, similar process with 9T:

# cat /proc/17146/stat

17146 (Isolated Web Co) S 12508 12381 12381 0 -1 4210944 97117 0 2661 0 2949 357 0 0 20 0 29 0 40635 2612400128 49283 18446744073709551615 94633562045136 94633562716048 140728373374192 0 0 0 0 69634 1082133752 0 0 0 17 3 0 0 0 0 0 94633562728784 94633562730040 94633579540480 140728373383286 140728373383478 140728373383478 140728373387231 0

# cat /proc/17146/statm

637793 49283 31604 165 0 36098 0

# cat /proc/17146/status

Name:   Isolated Web Co
Umask:  0022
State:  S (sleeping)
Tgid:   17146
Ngid:   0
Pid:    17146
PPid:   12508
TracerPid:      0
Uid:    1000    1000    1000    1000
Gid:    1000    1000    1000    1000
FDSize: 512
Groups: 0 1 2 3 4 6 10 10 11 14 18 26 27 27 78 85 250 991 996 1000 
NStgid: 17146
NSpid:  17146
NSpgid: 12381
NSsid:  12381
VmPeak:  2763116 kB
VmSize:  2551160 kB
VmLck:         0 kB
VmPin:         0 kB
VmHWM:    240916 kB
VmRSS:    197180 kB
RssAnon:           70776 kB
RssFile:          123884 kB
RssShmem:           2520 kB
VmData:   144232 kB
VmStk:       160 kB
VmExe:       660 kB
VmLib:    127116 kB
VmPTE:       992 kB
VmSwap:        0 kB
HugetlbPages:          0 kB
CoreDumping:    0
THP_enabled:    0
Threads:        29
SigQ:   0/127993
SigPnd: 0000000000000000
ShdPnd: 0000000000000000
SigBlk: 0000000000000000
SigIgn: 0000000000011002
SigCgt: 0000000fc0800cf8
CapInh: 0000000000000000
CapPrm: 0000000000000000
CapEff: 0000000000000000
CapBnd: 000001ffffffffff
CapAmb: 0000000000000000
NoNewPrivs:     1
Seccomp:        2
Seccomp_filters:        1
Speculation_Store_Bypass:       vulnerable
SpeculationIndirectBranch:      always enabled
Cpus_allowed:   ffffff
Cpus_allowed_list:      0-23
Mems_allowed:   00000000,00000001
Mems_allowed_list:      0
voluntary_ctxt_switches:        32542
nonvoluntary_ctxt_switches:     260

@aristocratos
Copy link
Owner

aristocratos commented Sep 21, 2021

@tmnhy
There, fixed in v1.0.4
Memory collection will now fallback to using /proc/[pid]/statm if values from /proc/[pid]/stat looks wrong.

@tmnhy
Copy link
Author

tmnhy commented Sep 21, 2021

thx great

@kkremitzki
Copy link

This was happening to me consistently earlier after a little less than an hour of runtime, but it seems to be fixed now, thanks.

@ghomem
Copy link

ghomem commented Jul 19, 2024

Semi on-topic question: what is the metric that btop uses for the memory of a process? RSS? PSS? Something custom?

(I am asking because the topic of memory metrics is confusing and different software tracks different things)

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

5 participants