TamtamHero / fw-fanctrl

A simple systemd service to better control Framework Laptop's fan(s)
BSD 3-Clause "New" or "Revised" License
180 stars 35 forks source link

[BUG] Crash - `EC returned error result code 1` #59

Closed Antikyth closed 2 weeks ago

Antikyth commented 1 month ago

Describe the bug fw-fanctrl often crashes, with the seemingly relevant error being EC returned error result code 1 (full report below). This usually happens after somewhere between a few seconds and 10 minutes I think (these are simply guesses based on my own time perception). It sounds like this might not be an error with fw-fanctrl to me, based on the fact it's saying "EC returned error...", but I imagine the error handling could certainly be more graceful (e.g. the UTF-8 decode error shown in the full report, which I interpret as not being the root cause of the crash).

To Reproduce I'm not entirely sure; clearly this is something unique to my setup, or it would be happening to everyone. But however you reproduce EC returning an error code 1 must be how.

Error message

$ sudo fw-fanctrl --run
speed: 15%, temp: 31°C, movingAverageTemp: 31.0°C, effectureTemp: 31.0°C
speed: 15%, temp: 31°C, movingAverageTemp: 31.0°C, effectureTemp: 31.0°C
speed: 15%, temp: 30°C, movingAverageTemp: 30.7°C, effectureTemp: 30°C
EC returned error result code 1
EC response has invalid checksum
EC returned too much data
Traceback (most recent call last):
  File "/usr/bin/fw-fanctrl", line 329, in <module>
    main()
  File "/usr/bin/fw-fanctrl", line 306, in main
    fan.run(debug=not args.no_log)
  File "/usr/bin/fw-fanctrl", line 252, in run
    self.printState()
  File "/usr/bin/fw-fanctrl", line 234, in printState
    currentTemperture = self.getActualTemperature()
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/bin/fw-fanctrl", line 189, in getActualTemperature
    rawOut = subprocess.run(bashCommand, stdout=subprocess.PIPE, shell=True, text=True).stdout
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/subprocess.py", line 550, in run
    stdout, stderr = process.communicate(input, timeout=timeout)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/subprocess.py", line 1196, in communicate
    stdout = self.stdout.read()
             ^^^^^^^^^^^^^^^^^^
  File "<frozen codecs>", line 322, in decode
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfd in position 143: invalid start byte

Environment (please complete the following information):

Antikyth commented 1 month ago

Even if this issue might not be with fw-fanctrl directly, if anyone could help me diagnose/fix the problem on my system that would be so appreciated 🙏🏻

TamtamHero commented 1 month ago

The crash you're showing here is due to the script being run manually, it's crashing in a debug method which is not called for normal operations. Its code could indeed do a better job at handling utf8 exceptions. Could you try to run sudo fw-fanctrl --run --no-logs instead, and see if/how it crashes ? It will prevent the call to the debug method.

Antikyth commented 1 month ago
EC returned error result code 7
Traceback (most recent call last):
  File "/usr/bin/fw-fanctrl", line 329, in <module>
    main()
  File "/usr/bin/fw-fanctrl", line 306, in main
    fan.run(debug=not args.no_log)
  File "/usr/bin/fw-fanctrl", line 243, in run
    temp = self.getActualTemperature()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/bin/fw-fanctrl", line 189, in getActualTemperature
    rawOut = subprocess.run(bashCommand, stdout=subprocess.PIPE, shell=True, text=True).stdout
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/subprocess.py", line 550, in run
    stdout, stderr = process.communicate(input, timeout=timeout)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/subprocess.py", line 1196, in communicate
    stdout = self.stdout.read()
             ^^^^^^^^^^^^^^^^^^
  File "<frozen codecs>", line 322, in decode
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8d in position 437: invalid start byte

Running sudo fw-fanctrl --run --no-log still crashes with this error.

leopoldhub commented 1 month ago

Hi, could you please give us the returned values of the locale command?

*edit: I keep clicking on the "Close issue" button by mistake...

leopoldhub commented 1 month ago

Hi @Antikyth, are you still having this problem?

leopoldhub commented 2 weeks ago

Hi @Antikyth,

Is this issue still relevant?

As it has been inactive for a month now, I will close it. If there is anything else I can do, please feel free to reopen it and I will do my best to help you.

Have a nice day.