thinkfan icon indicating copy to clipboard operation
thinkfan copied to clipboard

current master: std::bad_optional_access on config path /etc/thinkfan.conf

Open Aietes opened this issue 4 years ago • 6 comments

Hi there,

I set up a new machine, and tried to install thinkfan. Building and installing with the latest version 1.3.1 resulted in the following exception on start:

ERROR: Unhandled std::bad_optional_access: bad optional access.
errno = No such file or directory.
Backtrace:
thinkfan() [0x4497cd]
thinkfan() [0x4241ec]
/lib64/libstdc++.so.6(+0xad0bc) [0x7f744db130bc]
/lib64/libstdc++.so.6(+0xac119) [0x7f744db12119]
/lib64/libstdc++.so.6(__gxx_personality_v0+0x87) [0x7f744db12847]
/lib64/libgcc_s.so.1(+0x11494) [0x7f744d980494]
/lib64/libgcc_s.so.1(_Unwind_Resume+0x12e) [0x7f744d980ece]
thinkfan() [0x41e247]
thinkfan(YAML::convert<std::vector<thinkfan::wtf_ptr<thinkfan::FanConfig>, std::allocator<thinkfan::wtf_ptr<thinkfan::FanConfig> > > >::decode(YAML::Node const&, std::vector<thinkfan::wtf_ptr<thinkfan::FanConfig>, std::allocator<thinkfan::wtf_ptr<thinkfan::FanConfig> > >&)+0xf6) [0x459c86]
thinkfan(YAML::convert<thinkfan::wtf_ptr<thinkfan::Config> >::decode(YAML::Node const&, thinkfan::wtf_ptr<thinkfan::Config>&)+0x3d4) [0x44fd04]
thinkfan(thinkfan::Config::try_read_config(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)+0x221) [0x42e961]
thinkfan(thinkfan::Config::read_config(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)+0x1a) [0x42ec7a]
thinkfan(main+0x2db) [0x42816b]
/lib64/libc.so.6(+0x2d560) [0x7f744d792560]
/lib64/libc.so.6(__libc_start_main+0x7c) [0x7f744d79260c]
thinkfan(_start+0x25) [0x428c95]

This is probably a bug. Please consider reporting this at https://github.com/vmatare/thinkfan/issues. Thanks.
Aborted (core dumped)

Building and running 1.2.2 works fine. Did something change between versions that I missed, e.g. different config format?

Aietes avatar Apr 12 '22 16:04 Aietes

Hi, yes, I already fixed that, just forgot to push it. If you pull the latest master now that error should be gone.

vmatare avatar Apr 12 '22 18:04 vmatare

btw, that error should be happening only when thinkfan shuts down due to an unavailable fan. During normal operation it shouldn't be triggered. In what situation did you get it?

vmatare avatar Apr 12 '22 18:04 vmatare

I got the error on starting thinkfan, actually it throwed the exception right away. I'll try the new version now.

Aietes avatar Apr 26 '22 08:04 Aietes

No luck, I still get the same error on startup. Latest version, fresh build. It seems thinkfan can't find the config. Did the default location and/or filename change? I simply kept the old config with the same name in the same place, /etc/thinkfan.conf

Aietes avatar Apr 26 '22 09:04 Aietes

Got it working, default path for config file seems to have changed, it's now /etc/thinkfan.yaml

Aietes avatar Apr 26 '22 10:04 Aietes

Thanks for reporting back, you should definitely not be getting a std::bad_optional_access if your config is at /etc/thinkfan.conf, so that would be a bug.

vmatare avatar Apr 26 '22 18:04 vmatare

Several issues have been fixed now that were causing a bad_optional_access around tpacpi sensor initialization. Assuming this was one of them. Feel free to reopen if the problem reappears with the latest version.

vmatare avatar Nov 20 '22 20:11 vmatare