Closed exarkun closed 6 years ago
If I’m reading the stack traces correctly there’s two possible scenarios here:
1) Some kind of deadlock inside ffmpeg, see threads 3–7 spawned by ffmpeg waiting inside pthread_cond_wait. 2) Connectivity issues, i.e. network connection dropped and ffmpeg is waiting indefinitely for data (thread 2)
We might be able to eliminate option 2 by reintroducing timeouts. Can you apply this patch on top of 2e51a13 please? https://gist.github.com/2ce9b9a3ed9d575b8b986b99f64db181
My network is prone to a lot of mini-disruptions. I've applied the patch, I'll see how it goes and report back.
This morning, with the suggested patch applied, I had a run of pianobar which didn't hang for around 50 songs. This run without hangs is significantly longer than I've experienced with 2017.08.30. My network had an obvious hiccup somewhere around the 50 song mark. pianobar appeared to recover from this after a couple seconds. The next time it went to retrieve a playlist, though, it hung at that point and did not recover. Perhaps this is an unrelated bug? I hit Ctrl-C to try to make it recover to no effect. There's not much in the way of stack trace to report:
(gdb) thread apply all bt
Thread 1 (Thread 0x7f969defd300 (LWP 22901)):
#0 0x00007f969ac538c0 in __GI___select (nfds=1, readfds=0x7fff67a51b60, writefds=0x0, exceptfds=0x0, timeout=0x7fff67a51b50)
at ../sysdeps/unix/sysv/linux/select.c:41
#1 0x00005621b10c6fb5 in BarReadline (buf=0x7fff67a51c16 "", bufSize=2, mask=0x0, input=0x5621b12d5400 <app+736>,
flags=(BAR_RL_FULLRETURN | BAR_RL_NOECHO | BAR_RL_NOINT), timeout=1) at src/ui_readline.c:88
#2 0x00005621b10bd5d9 in BarMainHandleUserInput (app=0x5621b12d5120 <app>) at src/main.c:203
#3 0x00005621b10bdeb8 in BarMainLoop (app=0x5621b12d5120 <app>) at src/main.c:389
#4 0x00005621b10be3bc in main (argc=1, argv=0x7fff67a51e18) at src/main.c:491
(gdb)
Hm, it’s odd that pianobar doesn’t react to ^C. I guess we could try to restore timeouts for CURL as well and see how that goes: https://gist.github.com/efaceeefc4b9d0a27e9dde3735546c5e
Okay. Trying that patch today.
Early in my pianobar use today, with the above patch applied, it hung like this:
(i) Receiving new playlist... Network error: Timeout was reached
Just one thread again:
(gdb) thread apply all bt
Thread 1 (Thread 0x7fe9d541c300 (LWP 20020)):
#0 0x00007fe9d21728c0 in __GI___select (nfds=1, readfds=0x7ffde39d7190, writefds=0x0, exceptfds=0x0, timeout=0x7ffde39d7180)
at ../sysdeps/unix/sysv/linux/select.c:41
#1 0x000055cef8893108 in BarReadline (buf=0x7ffde39d7246 "", bufSize=2, mask=0x0, input=0x55cef8aa1400 <app+736>,
flags=(BAR_RL_FULLRETURN | BAR_RL_NOECHO | BAR_RL_NOINT), timeout=1) at src/ui_readline.c:88
#2 0x000055cef888a6a9 in BarMainHandleUserInput (app=0x55cef8aa1120 <app>) at src/main.c:203
#3 0x000055cef888af88 in BarMainLoop (app=0x55cef8aa1120 <app>) at src/main.c:389
#4 0x000055cef888b48c in main (argc=1, argv=0x7ffde39d7448) at src/main.c:491
(gdb)
Well, that error is expected if you add timeouts. But does that means you were not able to interact with pianobar (i.e. select different station) afterwards?
Yea, makes sense that sometimes the playlist fetch would fail with a timeout now. What's the expected behavior after this? Is it expected that pianobar will re-try the playlist download? Or, as it sounds like you're suggesting, does it just mean pianobar remains useable and will start playing tracks from a channel if I just use th UI to select one?
Unfortunately I can't recall for sure exactly what I did when that session hung. I may have hit Ctrl-C since I've observed that to "unstick" pianobar in the past. Or, just as likely, I may have left it alone to be sure to have a chance to attach gdb. So, sorry about that, I'll be more clear about what interactions are possible in the future.
What's the expected behavior after this? Is it expected that pianobar will re-try the playlist download? Or, as it sounds like you're suggesting, does it just mean pianobar remains useable and will start playing tracks from a channel if I just use th UI to select one? If a playlist fetch fails pianobar will just idle right now. You should be able to select a new (or the same) station and play that. Obviously a real patch needs some kind of retry mechanism.
Encountered a playlist download timeout this morning. The UI did remain responsive and I was able to re-select the station that was playing and play resumed.
The branch “timeout” contains the (hopefully) final fix, including retries. Can you give it a try before I merge it into master?
Thanks. I've used the branch for a couple days now and it seems to be behaving well with respect to timeouts and play-resumption.
Merged into master. Thanks again!
Referencing a few issues that might be duplicates of this one: #658, #654, #623, #610
Pianobar is awesome, thanks! Do you think we could get a new release with these fixes?
Sure, tagged 2018.06.22.
I see there are a number of issues in the tracker similar to this one. I don't know if my issue has the same underlying cause as any of them so I'm opening a new issue instead of attaching my comments/details to an existing issue.
Using pianobar on Ubuntu 17.10, either the packaged version (reports as 2017.08.30 - Ubuntu version 2017.08.30-1) or a debug-symbols-enabled version from source control (2e51a13fe816c0c0b02f7d7a19a4c739dcb66119), playback and the UI frequently hang.
Often Ctrl-C will get things moving again, but not always.
Here are stack traces from one recent hang of the custom-built version (gdb attached after the hang):