MPD icon indicating copy to clipboard operation
MPD copied to clipboard

Crashing mpd due to libsmbclient?

Open ephemeralriggs opened this issue 4 years ago • 7 comments

This is more of a question, but after disabling libsmbclient by default I could not help but notice that I have been running mpd (0.21) on a OSMC Vero 2 (quad core ARM Cortex A5) for years, playing everything via libsmbclient, and I have never observed it crashing. Is this problem more pronounced in the 0.22 series?

ephemeralriggs avatar Nov 28 '20 16:11 ephemeralriggs

Yes, MPD switched to using a separate SMBCCTX for each thread, to avoid deadlocking each others when one thread waits inside libsmbclient. Every time I tested the MPD/smbclient plugin family, I got annoying delays for each interaction, which I thought was unacceptable. Now it got worse, many of the delays are improved, but crashes have become much more likely. I don't want to support this awful library anymore. I wish there was an asynchronous (non-blocking) SMB client library. But as MPD has switched to io_uring for "local" file I/O, using kernel CIFS mounts have become better than using libsmbclient in any case.

MaxKellermann avatar Nov 30 '20 19:11 MaxKellermann

Thanks for the explanation. I'll have to look into how we handle this on FreeBSD best, then. We have a kernel CIFS module, but I haven't been using it in a while. A while back it used to have issues with disconnects (e.g. server reboots) which works okay-ish with libsmbclient. Also we don't have io_uring in FreeBSD. I wonder if implementing kqueue support would be worthwhile. Or wouldn't you accept a pull request for this anyway? (It's not high on my prioriy list, but someone else might beat me to it.)

ephemeralriggs avatar Dec 06 '20 16:12 ephemeralriggs

I'd happily accept code to improve MPD performance on FreeBSD (or any other operating system), if the code will be maintained. However, I'm not sure if kqueue helps in this case; of course kqueue is good, but it's like epoll on Linux (a scalable replacement for poll/select), but not like io_uring. The best approximation to io_uring on FreeBSD is probably aio, an API which Linux has abandoned for various reasons, in favor of io_uring. You can combine aio with kqueue, just like Linux can combine io_uring with epoll. But it's much more than just throwing some kqueue at MPD.

MaxKellermann avatar Feb 15 '21 13:02 MaxKellermann

To revive this thread (and hopefully close it soon) in the context of the 0.23 release:

  1. Personally, I have been using http instead of smb for quite some time. Works like a charm.
  2. I don't support smb in the official FreeBSD mpd package, and I haven't had a single complaint about it.
  3. It does not look like the libsmbclient bug is going to be fixed anytime soon.

Is it time to retire the plugin?

ephemeralriggs avatar Oct 17 '21 14:10 ephemeralriggs

I'm trying to compile mpd for android and use it on an android tv box. I don't have root access and cannot mount smb with cifs. SMB would have been useful for an external network hard drive. FTP may be an option, I will test it on MacOs before as at this time I can't achieve compilation for android.

amrx06 avatar Dec 07 '21 18:12 amrx06

@amrx06 WebDAV?

MaxKellermann avatar Dec 07 '21 19:12 MaxKellermann

@amrx06 WebDAV?

My old hard drive is only SMB v1 and FTP. I succeed to attach smb v1 on MPD under Ubuntu 20. I can stick to an actual/old version if you remove smbclient.

Next try is to compile mpd on android and try SMB there.

amrx06 avatar Dec 08 '21 10:12 amrx06