MycroftAI / docker-mycroft

Mycroft Development Environment inside Docker!
97 stars 63 forks source link

ALSA dies after a while #66

Open pabsi opened 4 years ago

pabsi commented 4 years ago

Hello there, using this with a Jabra 510 USB on the host, and works flawlessly for a while...eventually dying (not responding to "Hey Mycroft", and not even using mycroft-say-to command).

From the voice.log file:

2020-04-24 00:10:58.723 | INFO     |    31 | mycroft.client.speech.listener:create_wakeup_recognizer:360 | creating stand up word engine
2020-04-24 00:10:58.724 | INFO     |    31 | mycroft.client.speech.hotword_factory:load_module:386 | Loading "wake up" wake word via pocketsphinx
2020-04-24 00:10:58.747 | INFO     |    31 | mycroft.messagebus.client.client:on_open:67 | Connected
ALSA lib pcm.c:8306:(snd_pcm_recover) overrun occurred
ALSA lib pcm.c:8309:(snd_pcm_recover) cannot recovery from overrun, prepare failed: Input/output error
Expression 'alsa_snd_pcm_prepare( stream->capture.pcm )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2932
Expression 'AlsaStart( stream, 0 )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 3246
Expression 'AlsaRestart( self )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 3313
Expression 'PaAlsaStream_HandleXrun( stream )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 4520

My config in the host I am assuming it's correct, since it works on both the host, and the container (although just for a while in the latter).

For the container, I mount the pulse socket and the cookie as required in the README.

Any help would be appreciated.

mjkaye commented 4 years ago

I was getting this error message a while back. Unfortunately, I don't remember exactly what I did to fix it.

Does anything relevant show up in the host's logs at around the same timestamp? Have you tried running the container without the parameter --device /dev/snd? I don't use that parameter any more, but I don't remember whether that decision was specifically related to the error message.

pabsi commented 4 years ago

I did not check the host but I checked that aplay worked as expected, which it did in the host. Not inside the container.

Wait, if you don't use --device /dev/snd then how is it possible that you got it working? Are you currently using Mycroft inside docker? I certainly haven't tried that as I recall this being a mandatory requirement for anything in docker that needs to access the soundcard device.

mjkaye commented 4 years ago

I did not check the host but I checked that aplay worked as expected, which it did in the host. Not inside the container.

I think you've misunderstood me. I have no doubt that sound works on the host. However, the container's ability to play sound relies on communicating with the host's pulseaudio. Examining the host's logs, at the time that the container gives you the error message, may give insight into why that communication is impeded.

Wait, if you don't use --device /dev/snd then how is it possible that you got it working? Are you currently using Mycroft inside docker?

Yes, my dockerized Mycroft runs, with sound, for days at a time.

pabsi commented 4 years ago

Thanks @mjkaye I'll have a look around and get back with some results.

I was also considering running pulseaudio in the container, dedicated there, as I don't use sound in the host at all (it's a headless ubuntu server, so I don't really make any use of the sound directly from the host). I haven't explored this possibility yet.