http://redmine.audacious-media-player.org/http://redmine.audacious-media-player.org/welcome/favicon.ico?15159353402020-04-13T14:14:42ZRedmineAudacious - Bug #965: Audacious often crashes or freezes when a new cue file is played almost immediately after the end of the current playlist is reachedhttp://redmine.audacious-media-player.org/issues/965?journal_id=35912020-04-13T14:14:42ZJohn Lindgrenjohn@jlindgren.net
<ul></ul><p>Can you reinstall Audacious with debug symbols? The backtraces are not very useful otherwise.</p> Audacious - Bug #965: Audacious often crashes or freezes when a new cue file is played almost immediately after the end of the current playlist is reachedhttp://redmine.audacious-media-player.org/issues/965?journal_id=35932020-04-13T14:39:13ZIgor Kushnir
<ul></ul><p>I have already installed audacious and audacious-plugins built with debug symbols into /usr/local, but as I mentioned in the bug description, the version I built myself tends to freeze rather than crash and so doesn't produce a core dump or a backtrace. I've been able to view a frame stack in KDevelop a few times (it didn't look to me like anything easy to fix), but usually I just can't get anything at all out of a frozen Audacious process. If you can not reproduce this bug, I'll try to generate better backtraces.</p> Audacious - Bug #965: Audacious often crashes or freezes when a new cue file is played almost immediately after the end of the current playlist is reachedhttp://redmine.audacious-media-player.org/issues/965?journal_id=35952020-04-13T14:47:46ZJohn Lindgrenjohn@jlindgren.net
<ul></ul><p>I get a warning from the ALSA plugin, but no crash:<br /><pre>
ERROR alsa.cc:255 [get_delay_locked]: snd_pcm_recover failed: File descriptor in bad state.
</pre></p> Audacious - Bug #965: Audacious often crashes or freezes when a new cue file is played almost immediately after the end of the current playlist is reachedhttp://redmine.audacious-media-player.org/issues/965?journal_id=35962020-04-13T15:15:06ZJohn Lindgrenjohn@jlindgren.net
<ul></ul><p>Fixed the ALSA warning:<br /><a class="external" href="https://github.com/audacious-media-player/audacious-plugins/commit/c1a594bcc335acd9eec286b3c65b8fecc91e3d20">https://github.com/audacious-media-player/audacious-plugins/commit/c1a594bcc335acd9eec286b3c65b8fecc91e3d20</a></p>
<p>It looks like you are using PulseAudio. Can you change the output plugin to ALSA and see if that makes the crash go away?</p> Audacious - Bug #965: Audacious often crashes or freezes when a new cue file is played almost immediately after the end of the current playlist is reachedhttp://redmine.audacious-media-player.org/issues/965?journal_id=35972020-04-13T15:31:14ZIgor Kushnir
<ul></ul><p>I also had similar warnings in terminal and non-blocking error messages in the UI. Had to experiment with the sleep delay to make Audacious crash or freeze.</p>
<p>I have tested flac files directly instead of cue files that reference them, but never got a freeze or a crash without a cue intermediary. The two cue files I have reproduced the crash with have 17 and 22 tracks, they reference flac files of size 375 and 245 MiB respectively. This bug is not likely to be specific to the two cue files, because I chose them at random from my collection, and both allowed me to reproduce the crash. But the underlying file format (flac), file size (more than 200 MiB) and the significant number of tracks could make a difference.</p> Audacious - Bug #965: Audacious often crashes or freezes when a new cue file is played almost immediately after the end of the current playlist is reachedhttp://redmine.audacious-media-player.org/issues/965?journal_id=35982020-04-13T15:44:10ZIgor Kushnir
<ul></ul><p>John Lindgren wrote:</p>
<blockquote>
<p>Fixed the ALSA warning:<br /><a class="external" href="https://github.com/audacious-media-player/audacious-plugins/commit/c1a594bcc335acd9eec286b3c65b8fecc91e3d20">https://github.com/audacious-media-player/audacious-plugins/commit/c1a594bcc335acd9eec286b3c65b8fecc91e3d20</a></p>
<p>It looks like you are using PulseAudio. Can you change the output plugin to ALSA and see if that makes the crash go away?</p>
</blockquote>
<p>In fact, Output plugin was set to "ALSA Output" in my Audacious settings. When I set it to "PulseAudio Output", I can't reproduce the crash.</p>
<p>Just got the following alsa warning while trying to reproduce the crash twice, then a freeze:<br /><pre><code class="text syntaxhl"><span class="CodeRay">$ audacious
ERROR alsa.cc:255 [get_delay_locked]: snd_pcm_recover failed: Input/output error.
ERROR alsa.cc:255 [get_delay_locked]: snd_pcm_recover failed: Input/output error.
Killed
</span></code></pre></p>
<p>I'll test your commit now.</p> Audacious - Bug #965: Audacious often crashes or freezes when a new cue file is played almost immediately after the end of the current playlist is reachedhttp://redmine.audacious-media-player.org/issues/965?journal_id=35992020-04-13T16:02:58ZIgor Kushnir
<ul></ul><p>I pulled your commit, rebuilt and reinstalled audacious-plugins (but not audacious). Audacious still freezes with some sleep intervals and ALSA Output. Didn't get any alsa warnings after several attempts though.</p> Audacious - Bug #965: Audacious often crashes or freezes when a new cue file is played almost immediately after the end of the current playlist is reachedhttp://redmine.audacious-media-player.org/issues/965?journal_id=36002020-04-13T16:27:13ZJohn Lindgrenjohn@jlindgren.net
<ul></ul><p>It's almost certainly timing-related. You're hitting Audacious with a request to play a new track right at the end of the last one, as the audio buffer is draining. This is a transition state for the internals of the program, and some parts (e.g. decoding) are already done with the track while others are not. I made some changes in 4.0.x to make the UI more responsive in this state. A Git bisect would probably lead you to this commit<sup><a href="#fn1">1</a></sup>, but the bug isn't necessarily in that commit itself; more likely, it exposed some underlying issues (like the one in the ALSA plugin that I just fixed).</p>
<p>Some backtraces with debug symbols would be very helpful. I would suggest simply taking the Arch Linux PKGBUILDs and rebuilding them with the "debug" option enabled (see the makepkg manpage<sup><a href="#fn2">2</a></sup>).</p>
<p id="fn1" class="footnote"><sup>1</sup> <a class="external" href="https://github.com/audacious-media-player/audacious/commit/cd50db1079e0d0556c1bc5a700b91a9b27602a3c">https://github.com/audacious-media-player/audacious/commit/cd50db1079e0d0556c1bc5a700b91a9b27602a3c</a></p>
<p id="fn2" class="footnote"><sup>2</sup> <a class="external" href="https://www.archlinux.org/pacman/makepkg.conf.5.html">https://www.archlinux.org/pacman/makepkg.conf.5.html</a></p> Audacious - Bug #965: Audacious often crashes or freezes when a new cue file is played almost immediately after the end of the current playlist is reachedhttp://redmine.audacious-media-player.org/issues/965?journal_id=36032020-04-13T18:58:05ZIgor Kushnir
<ul><li><strong>File</strong> <a href="/attachments/847/audacious-4.0.1-1-debug-0.1s.backtrace">audacious-4.0.1-1-debug-0.1s.backtrace</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/847/audacious-4.0.1-1-debug-0.1s.backtrace">audacious-4.0.1-1-debug-0.1s.backtrace</a> added</li><li><strong>File</strong> <a href="/attachments/845/audacious-git-master-debug-0.2s.backtrace">audacious-git-master-debug-0.2s.backtrace</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/845/audacious-git-master-debug-0.2s.backtrace">audacious-git-master-debug-0.2s.backtrace</a> added</li><li><strong>File</strong> <a href="/attachments/844/audacious-git-master-debug-0.2s-2.backtrace">audacious-git-master-debug-0.2s-2.backtrace</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/844/audacious-git-master-debug-0.2s-2.backtrace">audacious-git-master-debug-0.2s-2.backtrace</a> added</li><li><strong>File</strong> <a href="/attachments/846/audacious-git-master-debug-0.2s-freeze.backtrace">audacious-git-master-debug-0.2s-freeze.backtrace</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/846/audacious-git-master-debug-0.2s-freeze.backtrace">audacious-git-master-debug-0.2s-freeze.backtrace</a> added</li><li><strong>File</strong> <a href="/attachments/843/audacious-git-master-debug-0.2s-freeze-2.backtrace">audacious-git-master-debug-0.2s-freeze-2.backtrace</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/843/audacious-git-master-debug-0.2s-freeze-2.backtrace">audacious-git-master-debug-0.2s-freeze-2.backtrace</a> added</li><li><strong>File</strong> <a href="/attachments/842/audacious-git-master-debug-0.2s-freeze-3.backtrace">audacious-git-master-debug-0.2s-freeze-3.backtrace</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/842/audacious-git-master-debug-0.2s-freeze-3.backtrace">audacious-git-master-debug-0.2s-freeze-3.backtrace</a> added</li><li><strong>File</strong> <a href="/attachments/841/audacious-git-master-debug-0.2s-3.backtrace">audacious-git-master-debug-0.2s-3.backtrace</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/841/audacious-git-master-debug-0.2s-3.backtrace">audacious-git-master-debug-0.2s-3.backtrace</a> added</li></ul>Now I suspect there are at least two bugs here. Crashes and freezes are not the same issues. Plus I got two different signals and backtraces for crashes. Reproducing a crash is more difficult than a freeze. I increased the sleep interval to 0.1, then to 0.2 to get a crash. In order to reproduce a crash I had to:
<ol>
<li>Start Audacious with command: <em>audacious -p</em></li>
<li>Navigate to at least 10 seconds before the end of the last song.</li>
<li>Switch to another maximized application and leave Audacious to finish playback in the background.</li>
<li>Repeat the previous two steps until Audacious crashes or freezes. If it freezes, execute <em>"killall -9 audacious"</em> and go to step 1.</li>
</ol>
<p>I have also found a way to extract a backtrace from a frozen application:<br /><pre><code>gdb -batch -ex "thread apply all bt" -ex "quit" -p 74310 > /path/to/backtrace
</code></pre></p>
<p>Attaching both crash and frozen backtraces with debug symbols. One backtrace is from Audacious 4.0.1 (Arch package with debug info), 0.1s delay; all others - from the current git master (both audacious and audacious-plugins), 0.2s delay.</p>
<p>Note the presence of nouveau_dri.so in the backtraces. There are known thread safety bugs in nouveau driver, so some of the crashes or freezes might be caused by it. Although I recall such crashes were mostly in Qt WebEngine code, which Audacious does not use.</p> Audacious - Bug #965: Audacious often crashes or freezes when a new cue file is played almost immediately after the end of the current playlist is reachedhttp://redmine.audacious-media-player.org/issues/965?journal_id=36042020-04-13T19:02:50ZIgor Kushnir
<ul></ul><p>Forgot to mention that I got the following output from crashing Audacious in terminal:<br /><pre><code class="text syntaxhl"><span class="CodeRay">$ audacious -p
terminate called after throwing an instance of 'std::system_error'
what(): No such process
Aborted (core dumped)
</span></code></pre></p> Audacious - Bug #965: Audacious often crashes or freezes when a new cue file is played almost immediately after the end of the current playlist is reachedhttp://redmine.audacious-media-player.org/issues/965?journal_id=36052020-04-13T19:37:54ZJohn Lindgrenjohn@jlindgren.net
<ul></ul><p>I am inclined to say that you have a libpthread, compiler, or CPU/firmware bug going on here. There are things in the backtraces that simply make no sense (std::terminate called when joining joinable() threads, deadlocks that are logically impossible, etc.)</p>
<p>I cannot help you further with this, sorry. It would take significant time, and access to the real hardware, to figure out what is really going on.</p> Audacious - Bug #965: Audacious often crashes or freezes when a new cue file is played almost immediately after the end of the current playlist is reachedhttp://redmine.audacious-media-player.org/issues/965?journal_id=36482020-04-20T15:03:59ZIgor Kushnir
<ul><li><strong>File</strong> <a href="/attachments/855/audacious-git-master-freeze-with-debug-output.backtrace">audacious-git-master-freeze-with-debug-output.backtrace</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/855/audacious-git-master-freeze-with-debug-output.backtrace">audacious-git-master-freeze-with-debug-output.backtrace</a> added</li><li><strong>File</strong> <a href="/attachments/856/audacious-git-master-freeze-with-debug-output.stderr">audacious-git-master-freeze-with-debug-output.stderr</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/856/audacious-git-master-freeze-with-debug-output.stderr">audacious-git-master-freeze-with-debug-output.stderr</a> added</li><li><strong>File</strong> <a href="/attachments/854/0001-Detect-pump_stop-deadlock.patch">0001-Detect-pump_stop-deadlock.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/854/0001-Detect-pump_stop-deadlock.patch">0001-Detect-pump_stop-deadlock.patch</a> added</li></ul><p>I have been able to narrow down the freeze, but not the crash yet. Attached my deadlock-detecting patch, stderr output and the backtrace of the frozen process.</p>
<p>As I understand, there is a race condition between <em>drain()</em> , <em>flush()</em> and <em>pump()</em>. In this case <em>drain()</em> and <em>flush()</em> both broadcast and attempt to join <em>pump_thread</em>. One of the broadcasts is lost, so only <em>drain()</em> succeeds, while <em>flush()</em> remains waiting indefinitely.</p> Audacious - Bug #965: Audacious often crashes or freezes when a new cue file is played almost immediately after the end of the current playlist is reachedhttp://redmine.audacious-media-player.org/issues/965?journal_id=36492020-04-20T16:16:27ZIgor Kushnir
<ul></ul><p>I have spent some time debugging the crash without success. Then switched to debugging the freeze and narrowed it down in no time. So I'm going to suspend debugging the crash until the freezing is fixed. There is hope that the fix will cover both issues. After all I can't reproduce the crash with PulseAudio output plugin. Perhaps this race condition corrupts pthread's private data, which then causes the crash. From <em>man 3</em> pthread_join:</p>
<blockquote>
<p>If multiple threads simultaneously try to join with the same thread, the results are undefined.</p>
</blockquote> Audacious - Bug #965: Audacious often crashes or freezes when a new cue file is played almost immediately after the end of the current playlist is reachedhttp://redmine.audacious-media-player.org/issues/965?journal_id=36502020-04-20T17:39:42ZJohn Lindgrenjohn@jlindgren.net
<ul></ul><p>Aha, that's some very good detective work. Thank you. I'll need to put some thought into how to solve this.</p> Audacious - Bug #965: Audacious often crashes or freezes when a new cue file is played almost immediately after the end of the current playlist is reachedhttp://redmine.audacious-media-player.org/issues/965?journal_id=36512020-04-20T19:15:19ZJohn Lindgrenjohn@jlindgren.net
<ul></ul><p>See if this helps:</p>
<p><a class="external" href="https://github.com/audacious-media-player/audacious-plugins/commit/0dac5d9a451700ffbbbd85427dc2d3661dc85bdb">https://github.com/audacious-media-player/audacious-plugins/commit/0dac5d9a451700ffbbbd85427dc2d3661dc85bdb</a></p> Audacious - Bug #965: Audacious often crashes or freezes when a new cue file is played almost immediately after the end of the current playlist is reachedhttp://redmine.audacious-media-player.org/issues/965?journal_id=36522020-04-21T08:25:47ZIgor Kushnir
<ul></ul><p>I installed git master versions of audacious and audacious-plugins and tried to reproduce the crash or the freeze maybe 30-40 times with different sleep delays. None happened. Thanks for the complete fix.</p>
<p>However during my testing with sleep delay 0.1 two times the following error appeared in the UI and in <em>audacious -p</em> output:<br /><pre>
ERROR alsa.cc:253 [get_delay_locked]: snd_pcm_recover failed: Input/output error.
</pre></p>
<p>Also, as used to happen during my earlier tests, there were the following string leak warnings in the output after I exited Audacious:</p>
<pre><code class="ruby syntaxhl"><span class="CodeRay"><span class="error">$</span> audacious -p
<span class="constant">ERROR</span> alsa.cc:<span class="integer">253</span> [get_delay_locked]: snd_pcm_recover <span class="key">failed</span>: <span class="constant">Input</span>/output error.
ERROR alsa.cc:<span class="integer">253</span> [get_delay_locked]: snd_pcm_recover <span class="key">failed</span>: <span class="constant">Input</span>/output error.
WARNING strpool.cc:<span class="integer">181</span> [operator()]: <span class="constant">String</span> <span class="key">leaked</span>: <span class="global-variable">$PERFORMER</span> - <span class="global-variable">$TITLE</span> - <span class="error">$</span>{<span class="constant">TRACK</span> <span class="integer">01</span> <span class="constant">TITLE</span>}
<span class="constant">WARNING</span> strpool.cc:<span class="integer">181</span> [operator()]: <span class="constant">String</span> <span class="key">leaked</span>: <span class="global-variable">$TITLE</span>
<span class="constant">WARNING</span> strpool.cc:<span class="integer">181</span> [operator()]: <span class="constant">String</span> <span class="key">leaked</span>: <span class="error">$</span>{<span class="constant">PATH</span> <span class="constant">TO</span> <span class="constant">THE</span> <span class="constant">DIRECTORY</span> <span class="constant">CONTAINING</span> <span class="constant">THE</span> <span class="constant">CUE</span> <span class="constant">FILE</span>}
<span class="constant">WARNING</span> strpool.cc:<span class="integer">181</span> [operator()]: <span class="constant">String</span> <span class="key">leaked</span>: <span class="constant">Free</span> <span class="constant">Lossless</span> <span class="constant">Audio</span> <span class="constant">Codec</span> (<span class="constant">FLAC</span>)
<span class="constant">WARNING</span> strpool.cc:<span class="integer">181</span> [operator()]: <span class="constant">String</span> <span class="key">leaked</span>: <span class="key">file</span>:<span class="regexp"><span class="delimiter">/</span><span class="delimiter">/</span></span><span class="error">$</span>{<span class="constant">URL</span>-<span class="constant">ENCODED</span> <span class="constant">ABSOLUTE</span> <span class="constant">PATH</span>}.flac
<span class="constant">WARNING</span> strpool.cc:<span class="integer">181</span> [operator()]: <span class="constant">String</span> <span class="key">leaked</span>: <span class="global-variable">$PERFORMER</span>
<span class="constant">WARNING</span> strpool.cc:<span class="integer">181</span> [operator()]: <span class="constant">String</span> <span class="key">leaked</span>: <span class="global-variable">$GENRE</span>
<span class="constant">WARNING</span> strpool.cc:<span class="integer">181</span> [operator()]: <span class="constant">String</span> <span class="key">leaked</span>: <span class="error">$</span>{<span class="constant">TRACK</span> <span class="integer">01</span> <span class="constant">TITLE</span>}
<span class="constant">WARNING</span> strpool.cc:<span class="integer">181</span> [operator()]: <span class="constant">String</span> <span class="key">leaked</span>: cue
<span class="constant">WARNING</span> strpool.cc:<span class="integer">181</span> [operator()]: <span class="constant">String</span> <span class="key">leaked</span>: lossless
<span class="constant">WARNING</span> strpool.cc:<span class="integer">181</span> [operator()]: <span class="constant">String</span> <span class="key">leaked</span>: <span class="key">file</span>:<span class="regexp"><span class="delimiter">/</span><span class="delimiter">/</span></span><span class="error">$</span>{<span class="constant">URL</span>-<span class="constant">ENCODED</span> <span class="constant">ABSOLUTE</span> <span class="constant">PATH</span>}.cue?<span class="integer">1</span>
<span class="constant">WARNING</span> runtime.cc:<span class="integer">364</span> [aud_leak_check]: <span class="constant">Bytes</span> allocated at <span class="key">exit</span>: <span class="integer">7360</span>
</span></code></pre>
<p>I replaced the actual strings with $VARIABLE, ${VARIABLE} as specified in the cue file that was in the tested <em>bash -c "sleep 0.0005 && audacious -p -E '/home/path/to/some filename.cue'"</em> command.<br />Note that these warnings happened often before, even in the absence of alsa errors.</p> Audacious - Bug #965: Audacious often crashes or freezes when a new cue file is played almost immediately after the end of the current playlist is reachedhttp://redmine.audacious-media-player.org/issues/965?journal_id=36532020-04-21T13:24:15ZJohn Lindgrenjohn@jlindgren.net
<ul><li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li><li><strong>Status</strong> changed from <i>New</i> to <i>Closed</i></li><li><strong>Category</strong> set to <i>plugins/alsa</i></li></ul> Audacious - Bug #965: Audacious often crashes or freezes when a new cue file is played almost immediately after the end of the current playlist is reachedhttp://redmine.audacious-media-player.org/issues/965?journal_id=36542020-04-21T13:25:59ZJohn Lindgrenjohn@jlindgren.net
<ul><li><strong>Target version</strong> set to <i>4.0.3</i></li></ul><p>I'll go ahead and close this, and if you can narrow down the conditions that lead to the leak warnings, please open a new report. Thanks for testing.</p>