JarbasHiveMind / HiveMind-voice-sat

OpenVoiceOS Voice Satellite
Apache License 2.0
17 stars 11 forks source link

Restarting pipewire puts hivemind-voice-sat into a broken state #34

Open Ramblurr opened 1 year ago

Ramblurr commented 1 year ago

When I restart pipewire the hivemind-sat goes into an unrecoverable state:

Sep 11 09:34:58 ovos-kitchen hivemind-sat[5024]: 2023-09-11 09:34:58.311 - HiveMind-voice-sat - ovos_microphone_plugin_alsa:_run:92 - WARNING - Bad chunk length: -32
Sep 11 09:34:58 ovos-kitchen hivemind-sat[5024]: 2023-09-11 09:34:58.313 - HiveMind-voice-sat - ovos_microphone_plugin_alsa:_run:92 - WARNING - Bad chunk length: -32
Sep 11 09:34:58 ovos-kitchen hivemind-sat[5024]: 2023-09-11 09:34:58.310 - HiveMind-voice-sat - ovos_dinkum_listener.service:run:263 - ERROR - voice_loop failed
Sep 11 09:34:58 ovos-kitchen hivemind-sat[5024]: Traceback (most recent call last):
Sep 11 09:34:58 ovos-kitchen hivemind-sat[5024]:   File "/home/ovos/.venv/lib/python3.11/site-packages/ovos_dinkum_listener/service.py", line 259, in run
Sep 11 09:34:58 ovos-kitchen hivemind-sat[5024]:     self.voice_loop.run()
Sep 11 09:34:58 ovos-kitchen hivemind-sat[5024]:   File "/home/ovos/.venv/lib/python3.11/site-packages/ovos_dinkum_listener/voice_loop/voice_loop.py", line 181, in run
Sep 11 09:34:58 ovos-kitchen hivemind-sat[5024]:     chunk = self.mic.read_chunk()
Sep 11 09:34:58 ovos-kitchen hivemind-sat[5024]:             ^^^^^^^^^^^^^^^^^^^^^
Sep 11 09:34:58 ovos-kitchen hivemind-sat[5024]:   File "/home/ovos/.venv/lib/python3.11/site-packages/ovos_microphone_plugin_alsa/__init__.py", line 47, in read_chunk
Sep 11 09:34:58 ovos-kitchen hivemind-sat[5024]:     return self._queue.get(timeout=self.timeout)
Sep 11 09:34:58 ovos-kitchen hivemind-sat[5024]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sep 11 09:34:58 ovos-kitchen hivemind-sat[5024]:   File "/usr/lib/python3.11/queue.py", line 179, in get
Sep 11 09:34:58 ovos-kitchen hivemind-sat[5024]:     raise Empty
Sep 11 09:34:58 ovos-kitchen hivemind-sat[5024]: _queue.Empty
Sep 11 09:34:58 ovos-kitchen hivemind-sat[5024]: 2023-09-11 09:34:58.321 - HiveMind-voice-sat - hivemind_voice_satellite.service:on_error:23 - ERROR - HiveMind Voice Satellite failed to launch ().
Sep 11 09:34:58 ovos-kitchen hivemind-sat[5024]: 2023-09-11 09:34:58.319 - HiveMind-voice-sat - ovos_microphone_plugin_alsa:_run:92 - WARNING - Bad chunk length: -32
Sep 11 09:34:58 ovos-kitchen hivemind-sat[5024]: 2023-09-11 09:34:58.324 - HiveMind-voice-sat - ovos_dinkum_listener.service:run:266 - INFO - Service stopping
Sep 11 09:34:58 ovos-kitchen hivemind-sat[5024]: 2023-09-11 09:34:58.324 - HiveMind-voice-sat - ovos_microphone_plugin_alsa:_run:92 - WARNING - Bad chunk length: -32
Sep 11 09:34:58 ovos-kitchen hivemind-sat[5024]: 2023-09-11 09:34:58.327 - HiveMind-voice-sat - ovos_microphone_plugin_alsa:_run:92 - WARNING - Bad chunk length: -32
Sep 11 09:34:58 ovos-kitchen hivemind-sat[5024]: 2023-09-11 09:34:58.329 - HiveMind-voice-sat - ovos_microphone_plugin_alsa:_run:92 - WARNING - Bad chunk length: -32
Sep 11 09:34:58 ovos-kitchen hivemind-sat[5024]: 2023-09-11 09:34:58.336 - HiveMind-voice-sat - hivemind_voice_satellite.service:on_stopping:19 - INFO - HiveMind Voice Satellite is shutting down...

The process just hangs there, and I have to manually restart the service. It would be better (imho) if the entire process exited when this error state is reached, then systemd/docker/etc can automatically restart the service.