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

Crash when sensor is unreadable #41

Closed
rdoursenaud opened this issue Aug 28, 2017 · 11 comments
Closed

Crash when sensor is unreadable #41

rdoursenaud opened this issue Aug 28, 2017 · 11 comments

Comments

@rdoursenaud
Copy link

I have several sensor paths declared.
Unfortunately, one (iwlwifi) is not readable since some kernel update for an undetermined reason.

When starting Thinkfan crashes with the trace below.

I'd expect it to issue warning about the unavailable sensor and continue.

ERROR: Unhandled std::ios_base::failure[abi:cxx11]: basic_filebuf::underflow error reading the file: iostream error.
errno = Input/output error.
Backtrace:
/usr/sbin/thinkfan(+0x37764) [0x55c6b0118764]
                                             /usr/sbin/thinkfan(thinkfan::handle_uncaught()+0x20b) [0x55c6b0119acb]
                                             /usr/lib/libstdc++.so.6(+0x8fc46) [0x7f8bfac95c46]
                                             /usr/lib/libstdc++.so.6(+0x8fc91) [0x7f8bfac95c91]
                                             /usr/lib/libstdc++.so.6(+0x8fed3) [0x7f8bfac95ed3]
                                             /usr/lib/libstdc++.so.6(std::__throw_ios_failure(char const*)+0x63) [0x7f8bfacc0a83]
                                             /usr/lib/libstdc++.so.6(std::basic_filebuf<char, std::char_traits<char> >::underflow()+0x39f) [0x7f8bfacf58bf]
                                             /usr/lib/libstdc++.so.6(std::istream::sentry::sentry(std::istream&, bool)+0x19a) [0x7f8bfad0206a]
                                             /usr/lib/libstdc++.so.6(std::istream::operator>>(int&)+0x2e) [0x7f8bfad0224e]
                                             /usr/sbin/thinkfan(thinkfan::HwmonSensorDriver::read_temps() const+0x176) [0x55c6b0108746]
                                             /usr/sbin/thinkfan(thinkfan::run(thinkfan::Config const&)+0x7d) [0x55c6b00fc6dd]
                                             /usr/sbin/thinkfan(main+0x422) [0x55c6b00fadd2]
                                             /usr/lib/libc.so.6(__libc_start_main+0xea) [0x7f8bfa6694ca]
                                             /usr/sbin/thinkfan(_start+0x2a) [0x55c6b00fb9ca]

/etc/thinkfan.conf

sensors:
  - hwmon: /sys/devices/platform/coretemp.0/hwmon/hwmon0/temp1_input  # CPU Package
  - hwmon: /sys/devices/platform/coretemp.0/hwmon/hwmon0/temp2_input  # CPU Core 0
  - hwmon: /sys/devices/platform/coretemp.0/hwmon/hwmon0/temp3_input  # CPU Core 1
  - hwmon: /sys/devices/platform/coretemp.0/hwmon/hwmon0/temp4_input  # CPU Core 2
  - hwmon: /sys/devices/platform/coretemp.0/hwmon/hwmon0/temp5_input  # CPU Core 3
  - hwmon: /sys/devices/virtual/hwmon/hwmon2/temp1_input  # pch_skylake
  - hwmon: /sys/devices/virtual/hwmon/hwmon3/temp1_input  # acpitz (ACPI CPU)
#  - hwmon: /sys/devices/virtual/hwmon/hwmon4/temp1_input  # iwlwifi
  - nvidia: 01:00.0  # nVidia GPU
  - atasmart: /dev/sda  # HDD
    correction: [10]

fans:
  - tpacpi: /proc/acpi/ibm/fan

levels:
  - [0, 0,  40]
  - [1, 32, 55]
  - [2, 54, 66]
  - [3, 65, 76]
  - [4, 75, 80]
  - [5, 78, 85]
  - [6, 82, 88]
  - [7, 85, 32767]
@vmatare vmatare self-assigned this Oct 13, 2017
@rdevulap
Copy link

May i know which thinkpad you are using @rdoursenaud ?

@rdoursenaud
Copy link
Author

Sure, I'm using a P51.
I've published the full specs and some notes on my blog: https://raphael.doursenaud.fr/lenovo-thinkpad-p51.html

In the meantime, I've noticed that this behavior is consistent with wifi being (software) disabled.
The iwlwifi module is still loaded and the hwmon path present but it returns an I/O error.
Other software trying to read it (like sensors or glances) issue a warning but don't crash.

@rdevulap
Copy link

rdevulap commented Oct 26, 2017

Awesome, thanks! I was thinking of buying a thinkpad, but wasn't sure if Lenevo still lets users control the fan speed. Does thinkfan let you control the fan?

@rdoursenaud
Copy link
Author

rdoursenaud commented Nov 22, 2017

Yes, it does :)
Using the thinkpad_acpi with /etc/modprobe.d/thinkpad_acpi.conf containing:

options thinkpad_acpi fan_control=1

And the P51 is a beast. Very happy with it so far!

@rdevulap
Copy link

Awesome, i just bought one too. I installed OpenSuse though and thinkpad_acpi driver seems to have some issues. I will switch to Arch linux and hopefully it will be okay.

@vmatare
Copy link
Owner

vmatare commented May 21, 2018

Hi, thanks for the report and for posting the backtrace, specifically. Having optional sensors is a feature currently in development, and this uncaught exception would have been a showstopper for certain ;-)

vmatare pushed a commit that referenced this issue May 21, 2018
hwmon file might be empty, causing the formatted input function to
throw. Should fix github issue #41 (untested).
@vmatare
Copy link
Owner

vmatare commented May 21, 2018

I just pushed the optional-sensors branch which should address this & related issues. Would be highly appreciated if you (or anyone) could test how it behaves in these situations.

vmatare pushed a commit that referenced this issue May 21, 2018
hwmon file might be empty, causing the formatted input function to
throw. Should fix github issue #41 (untested).
@rdoursenaud
Copy link
Author

rdoursenaud commented May 22, 2018

@vmatare Thanks for taking care of this use case.

Unfortunately, the optional-sensors branch won't build for me:

-- Checking for module 'openrc'
--   No package 'openrc' found
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/trizen-raph/thinkfan-git/src/thinkfan
[ 25%] Building CXX object CMakeFiles/thinkfan.dir/src/yamlconfig.cpp.o
[ 25%] Building CXX object CMakeFiles/thinkfan.dir/src/parser.cpp.o
/tmp/trizen-raph/thinkfan-git/src/thinkfan/src/parser.cpp: In member function ‘virtual thinkfan::SensorDriver* thinkfan::SensorParser::_parse(const char*&)’:
/tmp/trizen-raph/thinkfan-git/src/thinkfan/src/parser.cpp:149:42: error: no matching function for call to ‘thinkfan::AtasmartSensorDriver::AtasmartSensorDriver(std::__cxx11::basic_string<char>&)’
   sensor = new AtasmartSensorDriver(*path);
                                          ^
In file included from /tmp/trizen-raph/thinkfan-git/src/thinkfan/src/error.h:30,
                 from /tmp/trizen-raph/thinkfan-git/src/thinkfan/src/parser.cpp:22:
/tmp/trizen-raph/thinkfan-git/src/thinkfan/src/drivers.h:128:2: note: candidate: ‘thinkfan::AtasmartSensorDriver::AtasmartSensorDriver(thinkfan::string, bool, std::vector<int>)’
  AtasmartSensorDriver(string device_path, bool optional, std::vector<int> correction = {});
  ^~~~~~~~~~~~~~~~~~~~
/tmp/trizen-raph/thinkfan-git/src/thinkfan/src/drivers.h:128:2: note:   candidate expects 3 arguments, 1 provided
/tmp/trizen-raph/thinkfan-git/src/thinkfan/src/drivers.h:126:7: note: candidate: ‘thinkfan::AtasmartSensorDriver::AtasmartSensorDriver(const thinkfan::AtasmartSensorDriver&)’
 class AtasmartSensorDriver : public SensorDriver {
       ^~~~~~~~~~~~~~~~~~~~
/tmp/trizen-raph/thinkfan-git/src/thinkfan/src/drivers.h:126:7: note:   no known conversion for argument 1 from ‘std::__cxx11::basic_string<char>’ to ‘const thinkfan::AtasmartSensorDriver&’
make[2]: *** [CMakeFiles/thinkfan.dir/build.make:115: CMakeFiles/thinkfan.dir/src/parser.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In file included from /tmp/trizen-raph/thinkfan-git/src/thinkfan/src/yamlconfig.cpp:1:
/tmp/trizen-raph/thinkfan-git/src/thinkfan/src/yamlconfig.h: In instantiation of ‘YAML::wtf_ptr<T> YAML::make_wtf(TArgs ...) [with T = thinkfan::AtasmartSensorDriver; TArgs = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<int, std::allocator<int> >}]’:
/tmp/trizen-raph/thinkfan-git/src/thinkfan/src/yamlconfig.cpp:289:84:   required from here
/tmp/trizen-raph/thinkfan-git/src/thinkfan/src/yamlconfig.h:57:39: error: no matching function for call to ‘thinkfan::AtasmartSensorDriver::AtasmartSensorDriver(std::__cxx11::basic_string<char>&, std::vector<int>&)’
 { return wtf_ptr<T>(new unique_ptr<T>(new T(args...))); }
                                       ^~~~~~~~~~~~~~
In file included from /tmp/trizen-raph/thinkfan-git/src/thinkfan/src/error.h:30,
                 from /tmp/trizen-raph/thinkfan-git/src/thinkfan/src/config.h:25,
                 from /tmp/trizen-raph/thinkfan-git/src/thinkfan/src/yamlconfig.h:4,
                 from /tmp/trizen-raph/thinkfan-git/src/thinkfan/src/yamlconfig.cpp:1:
/tmp/trizen-raph/thinkfan-git/src/thinkfan/src/drivers.h:128:2: note: candidate: ‘thinkfan::AtasmartSensorDriver::AtasmartSensorDriver(thinkfan::string, bool, std::vector<int>)’
  AtasmartSensorDriver(string device_path, bool optional, std::vector<int> correction = {});
  ^~~~~~~~~~~~~~~~~~~~
/tmp/trizen-raph/thinkfan-git/src/thinkfan/src/drivers.h:128:2: note:   no known conversion for argument 2 from ‘std::vector<int>’ to ‘bool’
/tmp/trizen-raph/thinkfan-git/src/thinkfan/src/drivers.h:126:7: note: candidate: ‘thinkfan::AtasmartSensorDriver::AtasmartSensorDriver(const thinkfan::AtasmartSensorDriver&)’
 class AtasmartSensorDriver : public SensorDriver {
       ^~~~~~~~~~~~~~~~~~~~
/tmp/trizen-raph/thinkfan-git/src/thinkfan/src/drivers.h:126:7: note:   candidate expects 1 argument, 2 provided
make[2]: *** [CMakeFiles/thinkfan.dir/build.make:141: CMakeFiles/thinkfan.dir/src/yamlconfig.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:68: CMakeFiles/thinkfan.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

vmatare pushed a commit that referenced this issue Sep 30, 2018
hwmon file might be empty, causing the formatted input function to
throw. Should fix github issue #41 (untested).
@vmatare vmatare added this to the 1.1 milestone Jan 27, 2019
@vmatare vmatare added this to In progress in optional-sensors Jan 27, 2019
vmatare pushed a commit that referenced this issue Jan 31, 2019
hwmon file might be empty, causing the formatted input function to
throw. Should fix github issue #41 (untested).
vmatare pushed a commit that referenced this issue Oct 1, 2019
hwmon file might be empty, causing the formatted input function to
throw. Should fix github issue #41 (untested).
vmatare pushed a commit that referenced this issue Oct 2, 2019
hwmon file might be empty, causing the formatted input function to
throw. Should fix github issue #41 (untested).
vmatare pushed a commit that referenced this issue Oct 2, 2019
hwmon file might be empty, causing the formatted input function to
throw. Should fix github issue #41 (untested).
vmatare pushed a commit that referenced this issue Oct 2, 2019
hwmon file might be empty, causing the formatted input function to
throw. Should fix github issue #41 (untested).
vmatare pushed a commit that referenced this issue Oct 4, 2019
hwmon file might be empty, causing the formatted input function to
throw. Should fix github issue #41 (untested).
vmatare pushed a commit that referenced this issue Dec 30, 2019
hwmon file might be empty, causing the formatted input function to
throw. Should fix github issue #41 (untested).
vmatare pushed a commit that referenced this issue Apr 4, 2020
hwmon file might be empty, causing the formatted input function to
throw. Should fix github issue #41 (untested).
vmatare pushed a commit that referenced this issue Apr 4, 2020
hwmon file might be empty, causing the formatted input function to
throw. Should fix github issue #41 (untested).
vmatare pushed a commit that referenced this issue Apr 4, 2020
hwmon file might be empty, causing the formatted input function to
throw. Should fix github issue #41 (untested).
@vmatare vmatare modified the milestones: 1.1, 1.2 Apr 4, 2020
vmatare pushed a commit that referenced this issue Apr 6, 2020
hwmon file might be empty, causing the formatted input function to
throw. Should fix github issue #41 (untested).
vmatare pushed a commit that referenced this issue Apr 6, 2020
hwmon file might be empty, causing the formatted input function to
throw. Should fix github issue #41 (untested).
vmatare pushed a commit that referenced this issue Apr 6, 2020
hwmon file might be empty, causing the formatted input function to
throw. Should fix github issue #41 (untested).
vmatare pushed a commit that referenced this issue Apr 6, 2020
hwmon file might be empty, causing the formatted input function to
throw. Should fix github issue #41 (untested).
vmatare pushed a commit that referenced this issue Apr 8, 2020
hwmon file might be empty, causing the formatted input function to
throw. Should fix github issue #41 (untested).
vmatare pushed a commit that referenced this issue Apr 8, 2020
hwmon file might be empty, causing the formatted input function to
throw. Should fix github issue #41 (untested).
@vmatare
Copy link
Owner

vmatare commented Apr 8, 2020

anyone who wants this, please try out the optional-sensors branch. I need some feedback on how that is working for you so I can make it part of the next release.

@vmatare
Copy link
Owner

vmatare commented Apr 8, 2020

It's merged in the master branch now to give it some more exposition. Hoping for feedback ;-)

@vmatare vmatare moved this from In progress to Done in optional-sensors Apr 9, 2020
@vmatare
Copy link
Owner

vmatare commented Jun 5, 2020

Has been implemented in master for a while now, and will be part of upcoming release.

@vmatare vmatare closed this as completed Jun 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

No branches or pull requests

3 participants