Stream error & disconnect with browse by Genres, when a lot of entries

MAFA version: 3.2.3
Android version: 16
MPD version: 0.24.4-1 on Debian 13 stable

Hello,

I have a music library where one Genre totals 13.000+ tracks.

For HTTP streaming, this poses no problem to MAFA when running locally,

however, when running remotely over mobile network and tunnel, after 10 seconds spent in this Genre, MAFA fails and disconnects from the server, with error :

Command timeout in command : find ("genre == \"myGenre\")"

-> Visibly, what happens is the “find” mpd command is taking more than 10 seconds to return its full contents, and this is a problem to MAFA which trigger the error.

For information, I manually tested

mpc find ("genre == \"myGenre\")" 

in various contexts, and I confirm that returning the full data (1.2MB) is nearly instant locally, while it takes more than 10 seconds remotely over mobile network.

-> What to do ? You know better than me of course, but I’ve just had a look at the mpd protocol spec, and, “good news”, it supports sliced find.

So I guess that in order to improve MAFA resilience by making it insensitive to the network bandwidth, it would be beneficial to rearrange the “find” code around :

1- retrieval of total tracks count :

count "(genre == \"myGenre\")"

2- then, sliced retrieval of tracks list :

find "(genre == \"myGenre\")" window 0:500
find "(genre == \"myGenre\")" window 501:1000
...
find "(genre == \"myGenre\")" window 13000:13111

This, combined with the same 10 sec timeout, would allow to both

. fail if the network is really not capable enough

. and succeed otherwise

-> So what do you think ?

That being said, I’m very new to the mpd ecosystem (coming from windows + foobar2000), and I already love it, this includes MAFA, great piece of software, congrats.

By the way, did you consider making MAFA open-source, on github ? This would “make sense”, for a not for profit project, within an otherwise open-source ecosystem. And this would be more straightforward for bug reports :wink:

cheers

Thank you for reporting.

I tested a similar case (but with only 5,000 tracks) and it’s almost instantaneous on a 5G mobile network, going through an SSH tunnel from a server to MPD running at home.

Your case seems to be more demanding because of a larger payload and probably a slower network.

I can look into implementing the window on the command, but it’s not going to be of high priority at this time.

This app is now mostly in maintenance mode to keep it up to date with android and mpd changes, but there are no plans for significant additional work, and also no plan to open source it (too few users to justify the effort).

I agree that under optimal conditions (good mobile network coverage), there’s no problem :

  • laptop [network = smartphone 4G sharing] → openssh client tunnel to the remote server,
    mpc --host 127.0.0.1 --port 6600 find “(genre == “myGenre”)”
    → reliably takes 2 seconds

  • same smartphone [network = same 4G] → connectbot tunnel to the remote server,
    MAFA is in the Genre “myGenre” / view “Artists”
    → ok, no problem, and the 4G icon is lit during approx. 2 seconds

But whenever the mobile network bandwidth becomes average, we can face MAFA 10 seconds timeout.

Basically, for this library size, 1.2MB vs 10 secs timeout means the bandwidth requirement is 120KB/s (900kbps).

In a “perfect MAFA world” :slight_smile: , the minimum bandwidth requirement should be that of audio streaming (e.g. 160kbps for mp3@160), NOT that of the library size-induced downloads (e.g. 900 kbps above).
So I vote for trying the reach this “perfect MAFA world” objective :slight_smile:.

And in the mean time, maybe you can raise the timeout to 20 secs :slight_smile: for relaxed constraints on the bandwidth.

cheers

Yes, I’ll add a settings option for the command timeout for the next version.