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

"Display threads or programs" crashes #3051

Open
MariusAlbrecht opened this issue Dec 25, 2024 · 3 comments
Open

"Display threads or programs" crashes #3051

MariusAlbrecht opened this issue Dec 25, 2024 · 3 comments

Comments

@MariusAlbrecht
Copy link

MariusAlbrecht commented Dec 25, 2024

Describe the bug
Disabling the NPROC column ("Display threads or programs" / j shortcut) crashes the cli for me.
Additionally my terminal is kinda broken afterwards (scrolling doesn't work anymore, cursor and input isn't shown anymore, and some other things)

To Reproduce
Steps to reproduce the behavior:

  1. Start Glances without any ootions
  2. Press the key 'j' (shortcut for "Display threads or programs")
  3. Freeze for a bit then crash

Expected behavior
n/a

Screenshots
No sreenshot, i have the traceback printed to stderr instead:

Traceback (most recent call last):
  File "/usr/bin/glances", line 33, in <module>
    sys.exit(load_entry_point('Glances==4.0.5', 'console_scripts', 'glances')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/glances/__init__.py", line 173, in main
    start(config=core.get_config(), args=core.get_args())
  File "/usr/lib/python3/dist-packages/glances/__init__.py", line 121, in start
    mode.serve_forever()
  File "/usr/lib/python3/dist-packages/glances/standalone.py", line 181, in serve_forever
    while self.__serve_once():
          ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/glances/standalone.py", line 153, in __serve_once
    ret = not self.screen.update(self.stats, duration=adapted_refresh)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/glances/outputs/glances_curses.py", line 1186, in update
    self.flush(stats, cs_status=cs_status)
  File "/usr/lib/python3/dist-packages/glances/outputs/glances_curses.py", line 1167, in flush
    self.display(stats, cs_status=cs_status)
  File "/usr/lib/python3/dist-packages/glances/outputs/glances_curses.py", line 636, in display
    __stat_display = self.__get_stat_display(stats, layer=cs_status)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/glances/outputs/glances_curses.py", line 612, in __get_stat_display
    ret[p] = stats.get_plugin(p).get_stats_display(args=self.args, max_width=plugin_max_width)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/glances/plugins/plugin/model.py", line 918, in get_stats_display
    ret = {'display': display_curse, 'msgdict': self.msg_curse(args), 'align': align_curse}
                                                ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/glances/plugins/processlist/__init__.py", line 545, in msg_curse
    ret.extend(self.get_process_curses_data(process, position == args.cursor_position, args))
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/glances/plugins/processlist/__init__.py", line 461, in get_process_curses_data
    ret.append(self._get_process_curses_time(p, selected, args))
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/glances/plugins/processlist/__init__.py", line 329, in _get_process_curses_time
    user_system_time = p['cpu_times']['user'] + p['cpu_times']['system']
                       ~~~~~~~~~~~~~~^^^^^^^^
KeyError: 'user

Environement (please complete the following information)

  • lsb_release -a:
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description: Ubuntu 24.10
    Release: 24.10
    Codename: oracular

  • glances -V:
    Glances version: 4.0.5
    Glances API version: 4
    PsUtil version: 5.9.8
    Log file: /home/_____/.local/share/glances/glances.log

  • to install:
    sudo apt install glances

  • glances --issue:

 ______@_____:~$ glances --issue
===============================================================================
Glances 4.0.5 (/usr/lib/python3/dist-packages/glances/__init__.py)
Python 3.12.7 (/usr/bin/python3)
PsUtil 5.9.8 (/usr/lib/python3/dist-packages/psutil/__init__.py)
===============================================================================
alert         [OK]    0.00003s 
[]
amps          [OK]    0.00025s key=name 
[{'count': 0,
  'countmax': None,
  'countmin': 1.0,
  'key': 'name',
  'name': 'Dropbox',
  'refresh': 3.0,
  'regex': True,
  'result': None,
  'timer': 4.427329063415527}, ...]
cloud         [NA]
connections   [NA]
containers    [OK]    0.00332s 
[]
core          [OK]    0.00175s 
{'log': 16, 'phys': 8}
cpu           [OK]    0.00080s 
{'cpucore': 16,
 'ctx_switches': 0,
 'ctx_switches_gauge': 120572419,
 'guest': 0.0,
 'idle': 96.0,
 'interrupts': 0,
 'interrupts_gauge': 131066878,
 'iowait': 0.1,
 'irq': 0.0,
 'nice': 0.0,
 'soft_interrupts': 0,
 'soft_interrupts_gauge': 37564980,
 'steal': 0.0,
 'syscalls': 0,
 'syscalls_gauge': 0,
 'system': 1.8,
 'time_since_update': 2.462028741836548,
 'total': 0.0,
 'user': 2.1}
diskio        [OK]    0.00197s key=disk_name 
[{'disk_name': 'nvme0n1',
  'key': 'disk_name',
  'read_bytes': 0,
  'read_bytes_gauge': 8563680768,
  'read_count': 0,
  'read_count_gauge': 133203,
  'time_since_update': 2.459743022918701,
  'write_bytes': 0,
  'write_bytes_gauge': 11666846720,
  'write_count': 0,
  'write_count_gauge': 326748}, ...]
folders       [OK]    0.00005s 
[]
fs            [OK]    0.00218s key=mnt_point 
[{'device_name': '/dev/nvme0n1p5',
  'free': 67558633472,
  'fs_type': 'ext4',
  'key': 'mnt_point',
  'mnt_point': '/',
  'percent': 43.2,
  'size': 125390405632,
  'used': 51415011328}, ...]
gpu           [OK]    0.01617s key=gpu_id 
[{'fan_speed': None, 'gpu_id': 'amd0', 'key': 'gpu_id', 'mem': 82, 'name': 'AMD GPU', 'proc': 0, 'temperature': None}, ...]
help          [OK]    0.00001s 
None
ip            [OK]    0.00071s 
{'address': '***',
 'gateway': '***',
 'mask': '***',
 'mask_cidr': '***',
 'public_address': '***',
 'public_info_human': '***'}
irq           [NA]
load          [OK]    0.00008s 
{'cpucore': 16, 'min1': 0.32861328125, 'min15': 0.5986328125, 'min5': 0.52490234375}
mem           [OK]    0.00036s 
{'active': 4738215936,
 'available': 10419159040,
 'buffers': 206745600,
 'cached': 9851187200,
 'free': 10419159040,
 'inactive': 7785476096,
 'percent': 32.8,
 'shared': 62971904,
 'total': 15498776576,
 'used': 5079617536}
memswap       [OK]    0.00042s 
{'free': 4293390336,
 'percent': 0.0,
 'sin': 61440,
 'sout': 565248,
 'time_since_update': 2.500568151473999,
 'total': 4294963200,
 'used': 1572864}
network       [OK]    0.00072s key=interface_name 
[{'alias': None,
  'bytes_all': 240,
  'bytes_all_gauge': 1619262460,
  'bytes_all_rate_per_sec': 118.0,
  'bytes_recv': 240,
  'bytes_recv_gauge': 1565274789,
  'bytes_recv_rate_per_sec': 118.0,
  'bytes_sent': 0,
  'bytes_sent_gauge': 53987671,
  'bytes_sent_rate_per_sec': 0.0,
  'interface_name': 'wlo1',
  'key': 'interface_name',
  'speed': 0,
  'time_since_update': 2.0320913791656494}, ...]
now           [OK]    0.00007s 
{'custom': '2024-12-25 23:48:36 CET', 'iso': '2024-12-25T23:48:36+01:00'}
percpu        [OK]    0.00015s key=cpu_number 
[{'cpu_number': 0,
  'guest': 0.0,
  'guest_nice': 0.0,
  'idle': 0.0,
  'iowait': 0.0,
  'irq': 0.0,
  'key': 'cpu_number',
  'nice': 0.0,
  'softirq': 0.0,
  'steal': 0.0,
  'system': 0.0,
  'total': 100.0,
  'user': 0.0}, ...]
ports         [OK]    0.00001s key=indice 
[{'description': 'DefaultGateway',
  'host': '192.168.178.1',
  'indice': 'port_0',
  'key': 'indice',
  'port': 0,
  'refresh': 30,
  'rtt_warning': None,
  'status': 0.006922,
  'timeout': 3}, ...]
processcount  [OK]    0.18880s 
{'pid_max': 0, 'running': 1, 'sleeping': 275, 'thread': 1356, 'total': 407}
processlist   [OK]    0.00094s 
[]
psutilversion [OK]    0.00005s 
'5.9.8'
quicklook     [OK]    0.00073s 
{'cpu': 0.0,
 'cpu_hz': 2000000000.0,
 'cpu_hz_current': 1147802687.4999998,
 'cpu_log_core': 16,
 'cpu_name': 'AMD Ryzen 7 5825U with Radeon Graphics',
 'cpu_phys_core': 8,
 'load': 3.7,
 'mem': 32.8,
 'percpu': [{...}, {...}, {...}, {...}, {...}, {...}, {...}, {...}, {...}, {...}, {...}, {...}, {...}, {...}, {...},
            {...}],
 'swap': 0.0}
raid          [NA]
sensors       [OK]    0.00001s key=label 
[{'critical': 86,
  'key': 'label',
  'label': 'Composite',
  'type': 'SensorType.CPU_TEMP',
  'unit': 'C',
  'value': 22,
  'warning': 82}, ...]
smart         [NA]
system        [OK]    0.00001s 
{'hostname': 'einssechseins',
 'hr_name': 'Ubuntu 24.10 64bit / Linux 6.11.0-13-generic',
 'linux_distro': 'Ubuntu 24.10',
 'os_name': 'Linux',
 'os_version': '6.11.0-13-generic',
 'platform': '64bit'}
uptime        [OK]    0.00027s 
{'seconds': 457589}
version       [OK]    0.00003s 
'4.0.5'
wifi          [OK]    0.00029s key=ssid 
[{'key': 'ssid', 'quality_level': -54.0, 'quality_link': 56.0, 'ssid': 'wlo1'}, ...]
===============================================================================
Total time to update all stats: 0.22511s
===============================================================================

Additional context
n/a

You can also pastebin:

@MariusAlbrecht
Copy link
Author

reinstalling using apt doesnt fix.

@nicolargo
Copy link
Owner

Hi @MariusAlbrecht

what do you mean by "disabling the NPROC column" ? Just siwtching from the Threads view to the Programs view make Glances crash ?

Can you try the latest Glances version (avoid using the "old" Glances version provided by Ubuntu):

apt remove glances
cd ~
python3 -m venv
./venv/bin/pip install glances
./venv/bin/glances

@MariusAlbrecht
Copy link
Author

The version from pip doesn't have the issue.
But, before trying that I made the following recording to illustrate the issue so have a look if you want to:
glances

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants