justintime / docker-airsonos

Expose Sonos over Airplay via a Docker container
MIT License
60 stars 24 forks source link

Seems to hang on Ubuntu 14.04 #1

Closed tlc closed 9 years ago

tlc commented 9 years ago

Running on Ubuntu 14.04, the airsonos process starts.

$ docker logs airsonos
*** Running /etc/my_init.d/00_regen_ssh_host_keys.sh...
No SSH host key available. Generating one...
Creating SSH2 RSA key; this may take some time ...
Creating SSH2 DSA key; this may take some time ...
Creating SSH2 ECDSA key; this may take some time ...
*** Running /etc/my_init.d/10_dbus.sh...
*** Running /etc/rc.local...
*** Booting runit daemon...
*** Runit started as PID 78
Searching for Sonos devices on network...
Setting up AirSonos for Basement {192.168.1.12:1400}
Setting up AirSonos for Bedroom {192.168.1.15:1400}
Setting up AirSonos for Deck {192.168.1.10:1400}
Setting up AirSonos for Kitchen {192.168.1.13:1400}
Setting up AirSonos for Living Room {192.168.1.7:1400}
Setting up AirSonos for Office {192.168.1.5:1400}

ps shows the node process up:

$ ps -ef |grep airsonos
root     24280 24278  0 21:27 ?        00:00:00 runsv airsonos
99       24286 24280  0 21:27 ?        00:00:00 node /usr/bin/airsonos

But they don't show up on my OSX or iOS device lists.

If I exec into the container and run airsonos there, they do show up in my device lists.

$ docker exec -ti airsonos bash
root@mastershake:/# airsonos
*** WARNING *** The program 'nodejs' uses the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=nodejs>
*** WARNING *** The program 'nodejs' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=nodejs&f=DNSServiceRegister>
Searching for Sonos devices on network...
Setting up AirSonos for Bedroom {192.168.1.15:1400}
Setting up AirSonos for Deck {192.168.1.10:1400}
Setting up AirSonos for Kitchen {192.168.1.13:1400}
Setting up AirSonos for Basement {192.168.1.12:1400}
Setting up AirSonos for Living Room {192.168.1.7:1400}
Setting up AirSonos for Office {192.168.1.5:1400}

And ps shows node running twice. So the first one is hung?

$ ps -ef |grep airsonos
root     24280 24278  0 21:27 ?        00:00:00 runsv airsonos
99       24286 24280  0 21:27 ?        00:00:00 node /usr/bin/airsonos
troy     28595 16731  0 21:37 pts/0    00:00:00 docker exec -ti airsonos bash
root     28636 28600  0 21:37 pts/1    00:00:00 node /usr/bin/airsonos
tlc commented 9 years ago

If I kill the stuck node process, the baseimage stuff restarts it and it works. Perhaps the app is being started before some other part of the container is ready?

justintime commented 9 years ago

Hmm... 14.04 is my environment as well, and I haven't had any issues like this. I have seen issues where my devices were caching DNS and causing headaches. Is it possible that was your problem? You might try turning your wifi off and on again on your iPhone after airsonos starts up and see if that helps.

tlc commented 9 years ago

The not-seen/seen experience was the same on my iPhone and my Macbook Pro, but I'll try turning it off and on again tonight.

BTW, my wife's iPhone saw the duplicate entries I've seen mentioned elsewhere, but my devices did not.

The ps outputs from two different container runs show that the runsv's all run before any of their children start. But the child processes are started in different orders in the two runs.

# ps -ef
UID        PID  PPID  C STIME TTY          TIME CMD
root         1     0  0 15:37 ?        00:00:00 /usr/bin/python2 -u /sbin/my_init
root        13     1  0 15:37 ?        00:00:00 /usr/bin/runsvdir -P /etc/service log: ge pipeline;?Error opening file
root        14    13  0 15:37 ?        00:00:00 runsv cron
root        15    13  0 15:37 ?        00:00:00 runsv dbus
root        16    13  0 15:37 ?        00:00:00 runsv airsonos
root        17    13  0 15:37 ?        00:00:00 runsv syslog-ng
root        18    13  0 15:37 ?        00:00:00 runsv avahi
root        19    13  0 15:37 ?        00:00:00 runsv sshd
avahi       20    18  0 15:37 ?        00:00:00 avahi-daemon: running [mastershake.local]
103         22    15  0 15:37 ?        00:00:00 dbus-daemon --system --nofork
root        24    14  0 15:37 ?        00:00:00 /usr/sbin/cron -f
nobody      25    16  1 15:37 ?        00:00:00 node /usr/bin/airsonos
# ps -ef
UID        PID  PPID  C STIME TTY          TIME CMD
root         1     0  0 15:51 ?        00:00:00 /usr/bin/python2 -u /sbin/my_init
root        12     1  0 15:51 ?        00:00:00 /usr/bin/runsvdir -P /etc/service log: ge pipeline;?Error opening file
root        13    12  0 15:51 ?        00:00:00 runsv cron
root        14    12  0 15:51 ?        00:00:00 runsv dbus
root        15    12  0 15:51 ?        00:00:00 runsv airsonos
root        16    12  0 15:51 ?        00:00:00 runsv syslog-ng
root        17    12  0 15:51 ?        00:00:00 runsv avahi
root        18    12  0 15:51 ?        00:00:00 runsv sshd
root        19    13  0 15:51 ?        00:00:00 /usr/sbin/cron -f
103         20    14  0 15:51 ?        00:00:00 dbus-daemon --system --nofork
nobody      22    15  1 15:51 ?        00:00:00 node /usr/bin/airsonos
avahi       24    17  0 15:51 ?        00:00:00 avahi-daemon: running [mastershake.local]
justintime commented 9 years ago

I've created a docker build tagged as 'testing' against the runit_deps ( #2 ) branch. Can you give that a shot, and report back if that works?

tlc commented 9 years ago

It didn't work. But a 'sleep 5' in airsonos/run did.

justintime commented 9 years ago

Hmm. Likely mdns registers as "started" before it actually is. I'm not above a little hack that works... I'll push a commit with a sleep later this weekend.

Thanks for the help on this.

On Friday, May 22, 2015, tlc notifications@github.com wrote:

It didn't work. But a 'sleep 5' in airsonos/run did.

— Reply to this email directly or view it on GitHub https://github.com/justintime/docker-airsonos/issues/1#issuecomment-104833453 .

justintime commented 9 years ago

I added the sleep 5, committed, and merged. Docker builds are updating now. Thanks again for helping identify this. If for some reason this doesn't fully resolve the problem, let me know and I'll reopen it.