kingosticks / mopidy-tunein

Mopidy extension for playing music from tunein
Apache License 2.0
65 stars 14 forks source link

Backend hangs when HTTP address fails #31

Closed lulu3000 closed 8 years ago

lulu3000 commented 8 years ago

Hello,

Browse (with MusicBox) to TuneIn-Music-Bollywood and try to play Bollywoodradio (Berlin) This causes the MopdyServer to hang for several minutes, trying to load http://radio.bollywoodradio.de (which does not exists). Meanwhile no operation is possible, even restart of mopidy is stalled.

This occurs with a lot of stations.

I have mopidy 2.0 an the latest TuneIn Extension.

Here's the log starting from mopidy restart until the first position where it hangs:

2016-06-14 13:10:34,083 INFO [22230:Audio-2] mopidy.audio.actor: Audio output set to "autoaudiosink" 2016-06-14 13:10:34,114 INFO [22230:SomaFMBackend-4] urllib3.connectionpool: Starting new HTTPS connection (1): api.somafm.com 2016-06-14 13:10:34,228 INFO [22230:MainThread] mopidy.local.library: Loaded 103 local tracks using json 2016-06-14 13:10:35,107 INFO [22230:SomaFMBackend-4] mopidy_somafm.somafm: Loaded 33 SomaFM channels 2016-06-14 13:10:35,110 INFO [22230:MainThread] mopidy.commands: Starting Mopidy core 2016-06-14 13:10:35,173 INFO [22230:MainThread] mopidy.commands: Starting Mopidy frontends: MpdFrontend, HttpFrontend 2016-06-14 13:10:35,177 INFO [22230:MainThread] mopidy.mpd.actor: MPD server running at [::ffff:127.0.0.1]:6600 2016-06-14 13:10:35,183 INFO [22230:HttpFrontend-13] mopidy.http.actor: HTTP server running at [::ffff:192.168.2.4]:6680 2016-06-14 13:10:35,184 INFO [22230:MainThread] mopidy.commands: Starting GLib mainloop 2016-06-14 13:10:35,606 INFO [22230:TuneInBackend-9] urllib3.connectionpool: Starting new HTTP connection (1): opml.radiotime.com 2016-06-14 13:10:47,263 INFO [22230:MainThread] mopidy.commands: GLib mainloop got SIGTERM. Exiting... 2016-06-14 13:10:47,265 INFO [22230:MainThread] mopidy.commands: Stopping Mopidy frontends 2016-06-14 13:10:47,277 INFO [22230:MainThread] mopidy.commands: Stopping Mopidy core 2016-06-14 13:10:47,281 INFO [22230:MainThread] mopidy.commands: Stopping Mopidy backends 2016-06-14 13:10:47,297 INFO [22230:MainThread] mopidy.commands: Stopping Mopidy audio 2016-06-14 13:10:47,301 INFO [22230:MainThread] mopidy.commands: Stopping Mopidy mixer 2016-06-14 13:10:48,354 INFO [22308:MainThread] mopidy.main: Starting Mopidy 2.0.0 2016-06-14 13:10:48,535 INFO [22308:MainThread] mopidy.config: Loading config from builtin defaults 2016-06-14 13:10:48,544 INFO [22308:MainThread] mopidy.config: Loading config from /etc/mopidy/mopidy.conf 2016-06-14 13:10:48,549 INFO [22308:MainThread] mopidy.config: Loading config from command line options 2016-06-14 13:10:48,741 INFO [22308:MainThread] mopidy.main: Enabled extensions: local-sqlite, mpd, http, stream, m3u, youtube, somafm, softwaremixer, file, musicbox_webclient, local, tunein 2016-06-14 13:10:48,742 INFO [22308:MainThread] mopidy.main: Disabled extensions: none 2016-06-14 13:10:48,767 WARNING [22308:MainThread] root: pafy: youtube-dl not found; falling back to internal backend. This is not as well maintained as the youtube-dl backend. To hide this message, set the environmental variable PAFY_BACKEND to "internal". 2016-06-14 13:10:49,018 INFO [22308:MainThread] mopidy.commands: Starting Mopidy mixer: SoftwareMixer 2016-06-14 13:10:49,023 INFO [22308:MainThread] mopidy.commands: Starting Mopidy audio 2016-06-14 13:10:49,029 INFO [22308:MainThread] mopidy.commands: Starting Mopidy backends: YouTubeBackend, SomaFMBackend, StreamBackend, M3UBackend, FileBackend, LocalBackend, TuneInBackend 2016-06-14 13:10:49,072 INFO [22308:SomaFMBackend-4] urllib3.connectionpool: Starting new HTTPS connection (1): api.somafm.com 2016-06-14 13:10:49,086 INFO [22308:Audio-2] mopidy.audio.actor: Audio output set to "autoaudiosink" 2016-06-14 13:10:49,211 INFO [22308:MainThread] mopidy.local.library: Loaded 103 local tracks using json 2016-06-14 13:10:49,982 INFO [22308:SomaFMBackend-4] mopidy_somafm.somafm: Loaded 33 SomaFM channels 2016-06-14 13:10:49,987 INFO [22308:MainThread] mopidy.commands: Starting Mopidy core 2016-06-14 13:10:50,057 INFO [22308:MainThread] mopidy.commands: Starting Mopidy frontends: MpdFrontend, HttpFrontend 2016-06-14 13:10:50,063 INFO [22308:MainThread] mopidy.mpd.actor: MPD server running at [::ffff:127.0.0.1]:6600 2016-06-14 13:10:50,070 INFO [22308:HttpFrontend-13] mopidy.http.actor: HTTP server running at [::ffff:192.168.2.4]:6680 2016-06-14 13:10:50,071 INFO [22308:MainThread] mopidy.commands: Starting GLib mainloop 2016-06-14 13:10:50,601 INFO [22308:TuneInBackend-9] urllib3.connectionpool: Starting new HTTP connection (1): opml.radiotime.com 2016-06-14 13:12:04,667 INFO [22308:TuneInBackend-9] urllib3.connectionpool: Starting new HTTP connection (1): radio.bollywoodradio.de

kingosticks commented 8 years ago

This sounds exactly like https://github.com/mopidy/mopidy/issues/1521 (thanks @adamcik). You should find that setting the timeout lower stops this from happening. I need to port https://github.com/mopidy/mopidy/pull/1522 (and never just copy code like that again)

lulu3000 commented 8 years ago

Thank you, I will give it a try. Sorry, I am new to github (however into coding since 30 years) and didn't notice the option for postiing code.

kingosticks commented 8 years ago

Oh, no, no need to apologise. My comment about copying code was referring to the fact someone (presumably me) just copied the original bugged code from https://github.com/SeppSTA/mopidy/blob/develop/mopidy/stream/actor.py#L94 so that although the original code was recently fixed in Mopidy, it was obviously still broken here. Basically, I screwed up! Thanks for the bug report, will release a fixed version asap.

lulu3000 commented 8 years ago

Sorry, this are really a newbie questions, so if it annoys you, just don't answer. I could understand.

kingosticks commented 8 years ago

Since a fixed version is released you can just do pip install --upgrade mopidy-tunein and it should now work.

Otherwise, if you've downloaded and edited the source code yourself, you'd need to reinstall it with pip install . so that it gets copied to your system sites-packages and python can then find it. If you're interested there's a much better in-depth explanation at https://docs.mopidy.com/en/latest/devenv/#working-on-extensions

The bug existed in both places (since I copied the code). To fix the problem for tunein radio streams you would need to change/replace mopidy-tunein/actor.py. If you also want to fix the problem for other (non-tunein) streams then you need to download and install the latest development version mopidy from github. A fixed version of Mopidy should be released soon.

Hope that's cleared things up a bit.

lulu3000 commented 8 years ago

It works. You are just GREAT.

kingosticks commented 8 years ago

@SeppSTA is the hero here. Glad it's working again for you.