Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hiccup in cdio_paranoia #149

Closed
mistepien opened this issue Nov 13, 2017 · 12 comments
Closed

hiccup in cdio_paranoia #149

mistepien opened this issue Nov 13, 2017 · 12 comments

Comments

@mistepien
Copy link

mistepien commented Nov 13, 2017

Every few seconds there is a "pause", mpd becomes unresponsive and so on.
Both 0.20.11 and current git.
libc is musl, kernel is 4.13.12, architecture x86 (32bit),
libcdio-0.94, libcdioparanoia-10.2+0.94+2

maybe paranoia is too paranoid? maybe accuracy is not priority here?
cdrom is connected via usb.

@MaxKellermann
Copy link
Member

What does "becomes unresponsive" mean? What does "pause" mean? Check the verbose log for relevant messages.

@mistepien
Copy link
Author

mistepien commented Nov 13, 2017

"Pause" means "lack of music" without setting player state to pause according to protocol.
During such "pause" sderr is also paused, meanwhile normally there is

client: [2] process command "status"
client: [2] command returned 0
client: [2] process command "currentsong"
client: [2] command returned 0
client: [2] process command "playlistinfo "1437""
client: [2] command returned 0
client: [22] process command "status"

The only residue of "pause" lasting few seconds is

alsa_output: Underrun on ALSA device "hw:V102,0"

hw:V102,0 is my dac, and when files are played there no underruns.
dmesg says nothing. mpd 0.20.1 is solid like a rock in case of files.

dac is connected via usb, too.

@MaxKellermann
Copy link
Member

Even if the decoder thread stalls, the main thread which handles client commands should continue to run normally. A stall in the main thread is unusual. Please use strace -tttTp $(pidof mpd) -o /tmp/trace during such a hiccup and upload the output file. That can I hope I can see where the main thread stalls.
Of course, a stall in the decoder thread and xrun in the output thread is expected when the input is too slow.

@mistepien
Copy link
Author

mpd can be striped or no? should it be compiled in some special way?

@MaxKellermann
Copy link
Member

At this stage, stripped is ok. Use the same binary which you used to observe the problem.

@mistepien
Copy link
Author

ok, this trace, I stopped strace when mpd "paused".
trace1.txt

@mistepien
Copy link
Author

mistepien commented Nov 13, 2017

I changed bluray writer to old cd-rom. Pauses are now 1-2 seconds long every 15 seconds.

@MaxKellermann
Copy link
Member

Thanks, that trace was very useful. I think I found the problem. Please test with branch unlock_cdio (https://github.com/MusicPlayerDaemon/MPD/tree/unlock_cdio)

@mistepien
Copy link
Author

It works like a charm. Thanks a lot. No hiccups, even with bluray writer it works just great.

@MaxKellermann
Copy link
Member

Yay! This was an obvious mistake with MPD's mutex locking inside various input plugins, including the plugin which reads static file (what nearly everybody uses). This change will improve MPD by a biiig margin!

MaxKellermann added a commit that referenced this issue Nov 14, 2017
InputStream::Read() and InputStream::Seek() are called with the mutex
locked.  That means the implementation must not block, or unlock the
mutex before calling into blocking code.

Previously, a slow CD drive could stall the whole MPD process,
including the main thread, due to this problem.

Closes #149
@project-owner
Copy link

From which MPD version the fix is available? Thanks!

@iglosiggio
Copy link

I just want to thank you for this fix, i recently bought a laptop and the wakeups from the HDD made mpd hiccup a lot. Updating solved the problem (and i think this issue solved it all).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants