vmatare / thinkfan

The minimalist fan control program
GNU General Public License v3.0
534 stars 61 forks source link

std::bad_optional_access from TpFanDriver::lookup #187

Closed zapl closed 2 years ago

zapl commented 2 years ago

Similar looking crash to #183 but coming from TpFanDriver::lookup, not sure which file that is but it's not caused by the config file

ERROR: Unhandled std::bad_optional_access: bad optional access.
errno = No such file or directory.
Backtrace:
./thinkfan(+0xc4aa3) [0x55e9379bbaa3]
./thinkfan(thinkfan::handle_uncaught()+0x244) [0x55e9379bc3f8]
/lib/x86_64-linux-gnu/libstdc++.so.6(+0xad4fc) [0x7f04a2bf74fc]
/lib/x86_64-linux-gnu/libstdc++.so.6(+0xad567) [0x7f04a2bf7567]
/lib/x86_64-linux-gnu/libstdc++.so.6(+0xad809) [0x7f04a2bf7809]
./thinkfan(+0xb4e8a) [0x55e9379abe8a]
./thinkfan(std::optional<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const>::value() const &+0x33) [0x55e9379abf7b]
./thinkfan(thinkfan::Driver::path[abi:cxx11]() const+0x20) [0x55e9379ab9ec]
./thinkfan(thinkfan::TpFanDriver::lookup[abi:cxx11]()+0x51) [0x55e93799da61]
./thinkfan(+0xb47d1) [0x55e9379ab7d1]
./thinkfan(+0xb4ae0) [0x55e9379abae0]
./thinkfan(thinkfan::Driver::try_init()+0x27) [0x55e9379ab93d]
./thinkfan(thinkfan::Config::try_init_driver(thinkfan::Driver&) const+0x20) [0x55e93799356e]
./thinkfan(thinkfan::Config::init_fans() const+0xa4) [0x55e93799340c]
./thinkfan(main+0x337) [0x55e93798b6ff]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xd5) [0x7f04a296b565]
./thinkfan(_start+0x2e) [0x55e9379895be]

This is happening on a ThinkPad P14s Gen 2i on Ubuntu 21.04

thinkpad.yaml (and .conf)

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

# Simple mode: each entry is a [FANSPEED, LOWER_LIMIT, UPPER_LIMIT] tuple.
levels:
  - [0, 0,  41]
  - [1, 38, 51]
  - [2, 45, 56]
  - [3, 51, 61]
  - [4, 55, 64]
  - [5, 60, 66]
  - [6, 63, 68]
  - [7, 65, 74]
  - [127, 70, 3276]

both

built from master at "cleanup & simplify hwmon config design & search logic", debug build with all 3 optional dependencies disabled (cmake -DCMAKE_BUILD_TYPE=Debug -D USE_ATASMART:BOOL=off -D USE_NVML:BOOL=off -D USE_LM_SENSORS:BOOL=off .. but it's the same with default)

vmatare commented 2 years ago

Thanks a lot for this report! It was a minor oversight that should be fixed now with the latest update to the master branch.