hermes-python segmentation fault with .loop_start() and later .publish_continue_session()
maremoto opened this issue · 4 comments
Hi,
I am creating an app with python code and hermes-python api.
If mqtt client creates the hermes object and subscribe and then executes .loop_start() - non blocking thread - the app is unable to finish any conversation as the .publish_continue_session() method generates a segmentation fault.
And even initiating a session programmatically with .publish_start_session_action() produces a segmentation fault too.
Exactly with the same configuration and deployment and python software but initiating with .loop_forever() works fine.
LOGS:
[13:37:08] [Hotword] detected on site safebase, for model hey_snips
[13:37:08] [Asr] was asked to stop listening on site safebase
[13:37:08] [Hotword] was asked to toggle itself 'off' on site safebase
[13:37:08] [Dialogue] session with id 'd8b5337c-9a90-426d-8154-49958be58106' was started on site safebase
[13:37:08] [AudioServer] was asked to play a wav of 41.1 kB with id '683bd537-808a-4b17-b776-64e93785dea4' on site safebase
[13:37:08] [AudioServer] finished playing wav with id '683bd537-808a-4b17-b776-64e93785dea4'
[13:37:08] [Asr] was asked to listen on site safebase
[13:37:12] [Asr] captured text "help me" in 3.0s
[13:37:12] [Asr] was asked to stop listening on site safebase
[13:37:12] [AudioServer] was asked to play a wav of 93.1 kB with id '29de05f9-d2fd-401f-ae70-74fb839325e2' on site safebase
[13:37:13] [AudioServer] finished playing wav with id '29de05f9-d2fd-401f-ae70-74fb839325e2'
[13:37:13] [Nlu] was asked to parse input "help me"
[13:37:13] [Nlu] detected intent maremoto:helpMe with confidence score 1.000 for input "help me"
[13:37:13] [Dialogue] New intent detected maremoto:helpMe with confidence 1.000
Apr 06 13:37:13 snips-base snips-skill-server[1237]: INFO:snips_skill_server_lib::runner: [app_safe][out] * Continue assistance
here the python code of the app is executing hermes.publish_continue_session(session_id, sentence, intent_filter) <<<
Apr 06 13:37:13 snips-base snips-skill-server[1237]: INFO:snips_skill_server_lib::runner: [app_safe][err] Segmentation fault
Apr 06 13:37:13 snips-base snips-skill-server[1237]: WARN:snips_skill_server_lib::handler::nosandbox: child app_safe has stopped with status exit code: 139
PLATFORM and configuration:
pi@snips-base:~ $ grep -v '#' /etc/snips.toml | grep ^.
[snips-common]
[snips-analytics]
[snips-asr]
[snips-asr-google]
[snips-audio-server]
bind = "safebase@mqtt"
[snips-dialogue]
[snips-hotword]
audio = ["safebase@mqtt", "safependant0@mqtt"]
[snips-injection]
[snips-nlu]
[snips-tts]
[snips-pegasus]
pi@snips-base:/app_home $ sam connect localhost/.ssh/authorized_keys
? Enter username for the device: pi
? Enter password for the device: [hidden]
✔ Connected to localhost
i A public key has been generated and copied to the device at localhost:
pi@snips-base:~/app_home $ sam status
Connected to device localhost
OS version ................... Raspbian GNU/Linux 9 (stretch)
Installed assistant .......... SAFE
Language ..................... en
Hotword ...................... hey_snips
ASR engine ................... snips
Status ....................... Live
Service status:
snips-analytics .............. 0.62.3 (not running)
snips-asr .................... 0.62.3 (running)
snips-audio-server ........... 0.62.3 (running)
snips-dialogue ............... 0.62.3 (running)
snips-hotword ................ 0.62.3 (running)
snips-nlu .................... 0.62.3 (running)
snips-skill-server ........... 0.62.3 (running)
snips-tts .................... 0.62.3 (running)
pi@snips-base:/var/lib/snips/skills/snips-app-safe $ . venv/bin/activate
(venv) pi@snips-base:/var/lib/snips/skills/snips-app-safe $ pip list
Package Version
Adafruit-GPIO 1.0.3
Adafruit-PureIO 0.2.3
apa102-pi 2.2.0
enum34 1.1.6
future 0.17.1
hermes-python 0.4.1
pip 19.0.3
RPi.GPIO 0.6.5
setuptools 40.8.0
six 1.12.0
smbus2 0.2.3
spidev 3.4
typing 3.6.6
wheel 0.33.1
More info @ snipsco/snips-issues#116
Hi @maremoto ,
would you mind sharing an exerpt of your code ? I can't seem to understand reproduce your issue.
Hi @anthonyray,
Unfortunately I have not the original code to reproduce it.
With some tests I figured out that the problem is a race condition when a session has ended but my python code has not received the endSession message yet, and try to send a new message. So changing some timers values solved the situation for me because I was in a hurry.
If I found this again I will freeze the code and send it to you immediately in another issue, sorry for the inconvenience.
Thanks,
Mar
No inconvenience at all ! I'm striving to make hermes-python
the best I can, so gathering issues/feedback is very useful for me.