Segmentation fault in Assistant initialization on RPi 4 #355
Description
As a recent buyer of the new Raspberry Pi 4 I've been eager to try out some of my software on a more powerful machine, but I've so far bumped into a systematic segmentation fault when initializing the assistant that doesn't occur on other machines - neither on the previous RPi3 that had exactly the same hardware connected, nor on other Pis or on my laptop.
Code to replicate the issue:
import json
import google.oauth2.credentials
from google.assistant.library import Assistant
credentials_file = '/home/pi/.config/google-oauthlib-tool/credentials.json'
device_model_id = 'My Device'
with open(credentials_file, 'r') as f:
credentials = google.oauth2.credentials.Credentials(token=None, **json.load(f))
with Assistant(credentials, device_model_id) as assistant:
for event in assistant.start():
print(event)
with credentials.json
containing something like:
{"token_uri": "https://accounts.google.com/o/oauth2/token", "scopes": ["https://www.googleapis.com/auth/assistant-sdk-prototype"], "client_id": "****", "refresh_token": "****", "client_secret": "****"}
What I see on other machines:
ON_MUTED_CHANGED:
{"is_muted": false}
ON_MEDIA_STATE_IDLE
ON_START_FINISHED
...
What happens on the RPi 4: segmentation fault.
Stack trace:
(gdb) bt
#0 0xb6f831dc in strlen () from /usr/lib/arm-linux-gnueabihf/libarmmem-v7l.so
#1 0xb4facb10 in ?? () from /usr/local/lib/python3.7/dist-packages/google/assistant/library/libassistant_embedder.so
#2 0xb4fa9c8a in assistant_new () from /usr/local/lib/python3.7/dist-packages/google/assistant/library/libassistant_embedder.so
#3 0xb600acc0 in ffi_call_VFP () from /usr/lib/arm-linux-gnueabihf/libffi.so.6
#4 0xb600b6cc in ffi_call () from /usr/lib/arm-linux-gnueabihf/libffi.so.6
#5 0xb6044a38 in _ctypes_callproc () from /usr/lib/python3.7/lib-dynload/_ctypes.cpython-37m-arm-linux-gnueabihf.so
My educated guess is that at some point strlen()
gets a NULL or invalid pointer and crashes, but that ?? ()
frame in libassistant_embedded.so
won't allow me to see where exactly things are going wrong.
NOTE: the segmentation fault also occurs when using google-assistant-demo
:
$ google-assistant-demo --device-model-id Device
[1] 17095 segmentation fault (core dumped)
I'm using a stock Raspbian Buster image, the assistant library and sdk (with samples) have been installed via pip
, the machine is set up with a HiFi Berry soundcard for playback and a USB microphone for input (both used to work well with the assistant on the previous RPi 3 and Asus Tinker already) and the following ~/.asoundrc
:
pcm.!default {
type asym
playback.pcm {
type plug
slave.pcm "hw:0,0"
}
capture.pcm {
type plug
slave.pcm "hw:1,0"
}
}
Has the assistant SDK been tested on the new RPi 4 already? Are there any changes required to make it work or any hint on how to better investigate this issue?