amanusk / s-tui

Terminal-based CPU stress and monitoring utility
https://amanusk.github.io/s-tui/
GNU General Public License v2.0
4.06k stars 140 forks source link

Crash when changing temperature sensor #92

Closed christopher-dG closed 5 years ago

christopher-dG commented 5 years ago

Maybe this is similar to #79.

Step 1: Describe your environment

Step 2: Describe the problem:

Changing the temperature sensor to certain values will crash the program.

Observed Results:

Traceback (most recent call last):
  File "/usr/bin/s-tui", line 11, in <module>
    load_entry_point('s-tui==0.8.2', 'console_scripts', 's-tui')()
  File "/usr/lib/python3.7/site-packages/s_tui/s_tui.py", line 928, in main
    graph_controller.main()
  File "/usr/lib/python3.7/site-packages/s_tui/s_tui.py", line 760, in main
    self.loop.run()
  File "/usr/lib/python3.7/site-packages/urwid/main_loop.py", line 286, in run
    self._run()
  File "/usr/lib/python3.7/site-packages/urwid/main_loop.py", line 384, in _run
    self.event_loop.run()
  File "/usr/lib/python3.7/site-packages/urwid/main_loop.py", line 788, in run
    self._loop()
  File "/usr/lib/python3.7/site-packages/urwid/main_loop.py", line 825, in _loop
    self._watch_files[fd]()
  File "/usr/lib/python3.7/site-packages/urwid/raw_display.py", line 404, in <lambda>
    event_loop, callback, self.get_available_raw_input())
  File "/usr/lib/python3.7/site-packages/urwid/raw_display.py", line 502, in parse_input
    callback(processed, processed_codes)
  File "/usr/lib/python3.7/site-packages/urwid/main_loop.py", line 411, in _update
    self.process_input(keys)
  File "/usr/lib/python3.7/site-packages/urwid/main_loop.py", line 511, in process_input
    k = self._topmost_widget.keypress(self.screen_size, k)
  File "/usr/lib/python3.7/site-packages/urwid/container.py", line 595, in keypress
    *self.calculate_padding_filler(size, True)), key)
  File "/usr/lib/python3.7/site-packages/urwid/container.py", line 1590, in keypress
    key = self.focus.keypress(tsize, key)
  File "/usr/lib/python3.7/site-packages/urwid/container.py", line 2271, in keypress
    key = w.keypress((mc,) + size[1:], key)
  File "/usr/lib/python3.7/site-packages/s_tui/UiElements.py", line 37, in keypress
    return super(ViListBox, self).keypress(size, key)
  File "/usr/lib/python3.7/site-packages/urwid/listbox.py", line 999, in keypress
    key = focus_widget.keypress((maxcol,),key)
  File "/usr/lib/python3.7/site-packages/urwid/container.py", line 2271, in keypress
    key = w.keypress((mc,) + size[1:], key)
  File "/usr/lib/python3.7/site-packages/urwid/wimp.py", line 540, in keypress
    self._emit('click')
  File "/usr/lib/python3.7/site-packages/urwid/widget.py", line 460, in _emit
    signals.emit_signal(self, name, self, *args)
  File "/usr/lib/python3.7/site-packages/urwid/signals.py", line 265, in emit
    result |= self._call_callback(callback, user_arg, user_args, args)
  File "/usr/lib/python3.7/site-packages/urwid/signals.py", line 295, in _call_callback
    return bool(callback(*args_to_pass))
  File "/usr/lib/python3.7/site-packages/s_tui/TempSensorsMenu.py", line 114, in on_apply
    self.return_fn()
  File "/usr/lib/python3.7/site-packages/s_tui/s_tui.py", line 289, in on_sensors_menu_close
    self.__init__(self.controller)
  File "/usr/lib/python3.7/site-packages/s_tui/s_tui.py", line 233, in __init__
    urwid.WidgetPlaceholder.__init__(self, self.main_window())
  File "/usr/lib/python3.7/site-packages/s_tui/s_tui.py", line 552, in main_window
    self.controller.temp_thresh)
  File "/usr/lib/python3.7/site-packages/s_tui/Sources/TemperatureSource.py", line 54, in __init__
    self.update()
  File "/usr/lib/python3.7/site-packages/s_tui/Sources/TemperatureSource.py", line 107, in update
    update_func(sensor_major, int(sensor_minor))
  File "/usr/lib/python3.7/site-packages/s_tui/Sources/TemperatureSource.py", line 93, in update_func
    Source.update(self)
  File "/usr/lib/python3.7/site-packages/s_tui/Sources/Source.py", line 28, in update
    self.eval_hooks()
  File "/usr/lib/python3.7/site-packages/s_tui/Sources/Source.py", line 68, in eval_hooks
    if self.get_edge_triggered():
  File "/usr/lib/python3.7/site-packages/s_tui/Sources/TemperatureSource.py", line 190, in get_edge_triggered
    return self.last_temp > self.temp_thresh
TypeError: '>' not supported between instances of 'float' and 'NoneType'

Debug Results, output of s-tui -d created in a file _s-tui.log:

2018-10-08 12:19:36,746 [main()] [INFO ]  Started without root permissions
2018-10-08 12:19:36,746 [__init__()] [DEBUG]  Config file not found
2018-10-08 12:19:36,746 [__init__()] [DEBUG]  No refresh rate configed
2018-10-08 12:19:36,746 [__init__()] [DEBUG]  No user config for utf8
2018-10-08 12:19:36,746 [__init__()] [DEBUG]  No user config for temp sensor
2018-10-08 12:19:36,746 [__init__()] [DEBUG]  No user config for temp threshold
2018-10-08 12:19:36,747 [__init__()] [DEBUG]  stress-ng is not installed
2018-10-08 12:19:36,751 [__init__()] [DEBUG]  Sensor Label
2018-10-08 12:19:36,751 [__init__()] [DEBUG]  
2018-10-08 12:19:36,751 [__init__()] [DEBUG]  Sensor Label
2018-10-08 12:19:36,752 [__init__()] [DEBUG]  
2018-10-08 12:19:36,752 [__init__()] [DEBUG]  Sensor Label
2018-10-08 12:19:36,752 [__init__()] [DEBUG]  
2018-10-08 12:19:36,752 [__init__()] [DEBUG]  Sensor Label
2018-10-08 12:19:36,752 [__init__()] [DEBUG]  Package id 0
2018-10-08 12:19:36,752 [__init__()] [DEBUG]  Sensor Label
2018-10-08 12:19:36,752 [__init__()] [DEBUG]  Core 0
2018-10-08 12:19:36,752 [__init__()] [DEBUG]  Sensor Label
2018-10-08 12:19:36,752 [__init__()] [DEBUG]  Core 1
2018-10-08 12:19:36,752 [__init__()] [DEBUG]  Sensor Label
2018-10-08 12:19:36,752 [__init__()] [DEBUG]  Core 2
2018-10-08 12:19:36,752 [__init__()] [DEBUG]  Sensor Label
2018-10-08 12:19:36,752 [__init__()] [DEBUG]  Core 3
2018-10-08 12:19:36,752 [__init__()] [DEBUG]  Sensor Label
2018-10-08 12:19:36,752 [__init__()] [DEBUG]  
2018-10-08 12:19:36,753 [__init__()] [INFO ]  num cpus 8
2018-10-08 12:19:36,893 [update()] [INFO ]  Utilization recorded 7.6
2018-10-08 12:19:36,893 [__init__()] [DEBUG]  arg temp  None
2018-10-08 12:19:36,894 [init_update()] [DEBUG]  custom temp is None
2018-10-08 12:19:36,900 [init_update()] [DEBUG]  Temperature sensor is set to coretemp
2018-10-08 12:19:36,907 [set_threshold()] [DEBUG]  Temperature threshold set to 80.0
2018-10-08 12:19:36,913 [__init__()] [DEBUG]  Update is updated to <function TemperatureSource.init_update.<locals>.update at 0x7f9c2fd81ea0>
2018-10-08 12:19:36,915 [get_power_usage()] [INFO ]  current 121749731105.0 last 121749721950.0
2018-10-08 12:19:36,915 [get_power_usage()] [INFO ]  Joule_Used 0.009155 seconds_passed 0.0005934238433837891
2018-10-08 12:19:36,915 [get_power_usage()] [INFO ]  Power reading elapsed
2018-10-08 12:19:36,916 [get_power_usage()] [INFO ]  Max power updated 16
2018-10-08 12:19:36,918 [update()] [DEBUG]  Fan Speend Not Available
2018-10-08 12:19:36,918 [update()] [INFO ]  Fan speed recorded0.0
2018-10-08 12:19:36,941 [on_unicode_checkbox()] [DEBUG]  unicode State is False
2018-10-08 12:19:36,948 [update()] [INFO ]  Utilization recorded 24.4
2018-10-08 12:19:36,953 [get_power_usage()] [INFO ]  current 121750128382.0 last 121749731105.0
2018-10-08 12:19:36,953 [get_power_usage()] [INFO ]  Joule_Used 0.397277 seconds_passed 0.038439273834228516
2018-10-08 12:19:36,953 [get_power_usage()] [INFO ]  Power reading elapsed
2018-10-08 12:19:36,953 [update_displayed_graph_data()] [INFO ]  Reading 1114
2018-10-08 12:19:36,954 [update_displayed_graph_data()] [INFO ]  Reading 24.4
2018-10-08 12:19:36,954 [update_displayed_graph_data()] [INFO ]  Reading 32.0
2018-10-08 12:19:36,955 [update_displayed_graph_data()] [INFO ]  Reading 10.3351848350018
2018-10-08 12:19:36,958 [update()] [INFO ]  Utilization recorded 12.5
2018-10-08 12:19:36,961 [get_power_usage()] [INFO ]  current 121750233484.0 last 121750128382.0
2018-10-08 12:19:36,962 [get_power_usage()] [INFO ]  Joule_Used 0.105102 seconds_passed 0.008409738540649414
2018-10-08 12:19:36,962 [get_power_usage()] [INFO ]  Power reading elapsed
2018-10-08 12:19:36,962 [update_displayed_graph_data()] [INFO ]  Reading 1261
2018-10-08 12:19:36,962 [update_displayed_graph_data()] [INFO ]  Reading 12.5
2018-10-08 12:19:36,962 [update_displayed_graph_data()] [INFO ]  Reading 32.0
2018-10-08 12:19:36,963 [update_displayed_graph_data()] [INFO ]  Reading 12.49765370135798
2018-10-08 12:19:39,100 [update()] [INFO ]  Utilization recorded 11.0
2018-10-08 12:19:39,106 [get_power_usage()] [INFO ]  current 121769185706.0 last 121750233484.0
2018-10-08 12:19:39,107 [get_power_usage()] [INFO ]  Joule_Used 18.952222 seconds_passed 2.1449503898620605
2018-10-08 12:19:39,107 [get_power_usage()] [INFO ]  Power reading elapsed
2018-10-08 12:19:39,107 [update_displayed_graph_data()] [INFO ]  Reading 800
2018-10-08 12:19:39,108 [update_displayed_graph_data()] [INFO ]  Reading 11.0
2018-10-08 12:19:39,109 [update_displayed_graph_data()] [INFO ]  Reading 25.0
2018-10-08 12:19:39,110 [update_displayed_graph_data()] [INFO ]  Reading 8.835739087289005
2018-10-08 12:19:40,686 [on_sensors_menu_close()] [INFO ]  State is not None
2018-10-08 12:19:40,696 [__init__()] [DEBUG]  Sensor Label
2018-10-08 12:19:40,696 [__init__()] [DEBUG]  
2018-10-08 12:19:40,697 [__init__()] [DEBUG]  Sensor Label
2018-10-08 12:19:40,697 [__init__()] [DEBUG]  
2018-10-08 12:19:40,697 [__init__()] [DEBUG]  Sensor Label
2018-10-08 12:19:40,697 [__init__()] [DEBUG]  
2018-10-08 12:19:40,697 [__init__()] [DEBUG]  Sensor Label
2018-10-08 12:19:40,697 [__init__()] [DEBUG]  Package id 0
2018-10-08 12:19:40,697 [__init__()] [DEBUG]  Sensor Label
2018-10-08 12:19:40,698 [__init__()] [DEBUG]  Core 0
2018-10-08 12:19:40,698 [__init__()] [DEBUG]  Sensor Label
2018-10-08 12:19:40,698 [__init__()] [DEBUG]  Core 1
2018-10-08 12:19:40,698 [__init__()] [DEBUG]  Sensor Label
2018-10-08 12:19:40,698 [__init__()] [DEBUG]  Core 2
2018-10-08 12:19:40,698 [__init__()] [DEBUG]  Sensor Label
2018-10-08 12:19:40,698 [__init__()] [DEBUG]  Core 3
2018-10-08 12:19:40,698 [__init__()] [DEBUG]  Sensor Label
2018-10-08 12:19:40,698 [__init__()] [DEBUG]  
2018-10-08 12:19:40,702 [__init__()] [INFO ]  num cpus 8
2018-10-08 12:19:40,849 [update()] [INFO ]  Utilization recorded 7.9
2018-10-08 12:19:40,849 [__init__()] [DEBUG]  arg temp  pch_skylake,0,
2018-10-08 12:19:40,850 [init_update()] [DEBUG]  custom temp is pch_skylake,0,
2018-10-08 12:19:40,850 [init_update()] [DEBUG]  Selected custom temp
2018-10-08 12:19:40,850 [init_update()] [DEBUG]  Major pch_skylake Minor 0
2018-10-08 12:19:40,856 [set_threshold()] [DEBUG]  Temperature threshold set to None

Step 3: Reproduce the problem:

Steps to reproduce:

  1. Start s-tui
  2. Choose a different temp sensor, press apply

It doesn't happen on all sensors, just some. For me it was 2/9. Running as root doesn't change anything.

amanusk commented 5 years ago

Thanks for the issue, this is actually a duplicate of #87, and should be fixed when #89 is merged