custom-components / sensor.airthings_wave

hassio support for Airthings Wave BLE environmental radon sensor.
MIT License
100 stars 28 forks source link

Crash, thread crashed and no more sensor data was received. (in Fork sverrham) #22

Closed sverrham closed 4 years ago

sverrham commented 4 years ago

Crashed on my system this is running from my fork sverrham. trying to read data from an Airthings wave plus. Worked stable for 6hours before it crashed.

2020-01-29 05:22:35 DEBUG (Thread-3) [custom_components.airthings_wave.sensor] C onnecting to Thread-3 Exception in thread Thread-3: Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/pexpect/spawnbase.py", line 166, in read_nonblocking s = os.read(self.child_fd, size) OSError: [Errno 5] I/O error During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/pexpect/expect.py", line 111, in expect_loop incoming = spawn.read_nonblocking(spawn.maxread, timeout) File "/usr/local/lib/python3.7/site-packages/pexpect/pty_spawn.py", line 485, in read_nonblocking return super(spawn, self).read_nonblocking(size) File "/usr/local/lib/python3.7/site-packages/pexpect/spawnbase.py", line 171, in read_nonblocking raise EOF('End Of File (EOF). Exception style platform.') pexpect.exceptions.EOF: End Of File (EOF). Exception style platform. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.7/threading.py", line 926, in _bootstrap_inner self.run() File "/config/custom_components/airthings_wave/sensor.py", line 366, in run adapter.start(reset_on_start=False) File "/usr/local/lib/python3.7/site-packages/pygatt/backends/gatttool/gatttool .py", line 289, in start self._con.expect(r'\[LE\]>', timeout=initialization_timeout) File "/usr/local/lib/python3.7/site-packages/pexpect/spawnbase.py", line 341, in expect timeout, searchwindowsize, async_) File "/usr/local/lib/python3.7/site-packages/pexpect/spawnbase.py", line 369, in expect_list return exp.expect_loop(timeout) File "/usr/local/lib/python3.7/site-packages/pexpect/expect.py", line 117, in expect_loop return self.eof(e) File "/usr/local/lib/python3.7/site-packages/pexpect/expect.py", line 63, in e of raise EOF(msg) pexpect.exceptions.EOF: End Of File (EOF). Exception style platform. <pexpect.pty_spawn.spawn object at 0xadb86b90> command: /usr/bin/gatttool args: ['/usr/bin/gatttool', '-i', 'hci0', '-I'] buffer (last 100 chars): b'' after: <class 'pexpect.exceptions.EOF'> match: None match_index: None exitstatus: None flag_eof: True pid: 396 child_fd: 17 closed: False timeout: 30 delimiter: <class 'pexpect.exceptions.EOF'> logfile: None logfile_read: None logfile_send: None maxread: 2000 ignorecase: False searchwindowsize: None delaybeforesend: 0.05 delayafterclose: 0.1 delayafterterminate: 0.1 searcher: searcher_re: 0: re.compile(b'\\[LE\\]>')

MartyTremblay commented 4 years ago

I'm experiencing stability issues myself, and this even before your refactoring.

It feels like it's an underlying problem, possibly with gatttool or one of it's dependencies. Looking at the error message, gatttool returns an empty byte, and this without an exit code, which leads me to think that it crashes the thread altogether.

sverrham commented 4 years ago

Yes, maybe it is fixed now actually since we do not use a threaded reader, I don't remember if this included that.

I will see if it hapens again, but I think you are right that it probably is an underlying problem, maybe it will be fixed when the bluetooth driver is updated.

MartyTremblay commented 4 years ago

What I'm noticing after upping the log level for pygatt is that it seems to hang on this command, but only after a few times.

2020-03-13 13:56:45 DEBUG (SyncWorker_15) [pygatt.backends.gatttool.gatttool] gatttool_cmd=gatttool -i hci0 -I
2020-03-13 13:56:55 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.98_07_2d_4a_97_5c_date_time is taking over 10 seconds
2020-03-13 14:01:46 WARNING (MainThread) [homeassistant.components.sensor] Updating airthings_wave sensor took longer than the scheduled update interval 0:05:00
sverrham commented 4 years ago

So my guess is that this is HW related, I have not had any issues with this running on my raspberry pi 4.

Or maybe it is a conflict on using the Bluetooth, I don't have anything else accessing the ble hw.

(Because of the covid-19 situation I do not have time to work on this much, maybe not at all next couple of weeks)

On Fri, Mar 13, 2020, 19:07 Martin Tremblay notifications@github.com wrote:

What I'm noticing after upping the log level for pygatt is that it seems to hang on this command, but only after a few times.

2020-03-13 13:56:45 DEBUG (SyncWorker_15) [pygatt.backends.gatttool.gatttool] gatttool_cmd=gatttool -i hci0 -I 2020-03-13 13:56:55 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.98_07_2d_4a_97_5c_date_time is taking over 10 seconds 2020-03-13 14:01:46 WARNING (MainThread) [homeassistant.components.sensor] Updating airthings_wave sensor took longer than the scheduled update interval 0:05:00

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/custom-components/sensor.airthings_wave/issues/22#issuecomment-598849151, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABDYNSKB53FCDE2VNFTTX23RHJY7ZANCNFSM4KNJFENQ .

MartyTremblay commented 4 years ago

Closing since this seems to be an isolated problem