GRPC Pushtotalk hangs after a few secs of inactivity #230
Description
System: Raspberry Pi 3 + Matrix Creator (for mics)
OS: Debian Stretch
Using portaudio, no pulseaudio
When I launch the pushtotalk.py, everything works fine as long as I keep activating (pressing enter) and talking. I can perform several requests and will get proper responses. Mics work, speech works, all good.
But whenever I leave the program waiting for input ("Press Enter to send a new request...") for longer than a few seconds it will hang on the next activation.
This will happen every time, even when no request was made before. In the code below, I used ctrl+C once it froze. Then another ctrl+C after receiving the traceback.
After that, the client doesn't seem to successfully exit. Sometimes, the system completely freezes up (hard reboot required), but even it doesn't, the Pi refuses to properly reboot. If I try, the system will hang during shutdown, again requiring a hard reboot.
Log:
DEBUG:google.auth.transport.requests:Making request: POST https://accounts.google.com/o/oauth2/token
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): accounts.google.com
DEBUG:urllib3.connectionpool:https://accounts.google.com:443 "POST /o/oauth2/token HTTP/1.1" 200 None
INFO:root:Connecting to embeddedassistant.googleapis.com
INFO:root:Using device model xxx-matrix-creator-xxx and device id xxxx-3a88-11e8-9d84-b82xxxxx
Press Enter to send a new request...
INFO:root:Recording audio request.
DEBUG:root:AssistRequest: config {
audio_in_config {
encoding: LINEAR16
sample_rate_hertz: 16000
}
audio_out_config {
encoding: LINEAR16
sample_rate_hertz: 16000
volume_percentage: 50
}
dialog_state_in {
language_code: "en-US"
}
device_config {
device_id: "xxxxx-3a88-11e8-9d84-b827xxxxx"
device_model_id: "xxxx-matrix-creator-main-xxxx"
}
}
^C
Aborted!
^CException ignored in: <module 'threading' from '/usr/lib/python3.5/threading.py'>
Traceback (most recent call last):
File "/usr/lib/python3.5/threading.py", line 1288, in _shutdown
t.join()
File "/usr/local/lib/python3.5/dist-packages/grpc/_common.py", line 135, in join
super(CleanupThread, self).join(timeout)
File "/usr/lib/python3.5/threading.py", line 1054, in join
self._wait_for_tstate_lock()
File "/usr/lib/python3.5/threading.py", line 1070, in _wait_for_tstate_lock
elif lock.acquire(block, timeout):
KeyboardInterrupt
^C
My Alsa .asoundrc:
pcm.!default {
type asym
capture.pcm "mic"
playback.pcm "speaker"
}
pcm.mic {
type softvol
slave {
pcm "array"
}
control {
name "MicArray Master"
card 0
}
}
pcm.speaker {
type plug
slave {
pcm "hw:0,0"
}
}
pcm.array {
type plug
slave {
pcm "hw:2,0"
}
}