DDoSing Media Servers

simbun

Major Contributor
Joined
Mar 4, 2023
Messages
830
@WiiM Support

When browsing a media server through Home Music Share if you use the search function it performs a UPnP search after every letter you type, which on a large collection can be quite a significant overhead, even on a fast server.

A search for adele resulted in:

Code:
# a
09:31:24.957 Thread-10:  SearchCriteria=upnp:class derivedfrom "object.item.audioItem" and (dc:title contains "a" or upnp:artist contains "a" or dc:creator contains "a") StartingIndex=0 RequestedCount=2000 Filter=* SortCriteria=
09:31:28.521 Thread-10:  NumberReturned=2000 TotalMatches=27095 UpdateID=393
09:31:29.708 Thread-12:  SearchCriteria=upnp:class derivedfrom "object.item.audioItem" and (dc:title contains "a" or upnp:artist contains "a" or dc:creator contains "a") StartingIndex=2000 RequestedCount=2000 Filter=* SortCriteria=
09:31:34.557 Thread-5:  SearchCriteria=upnp:class derivedfrom "object.item.audioItem" and (dc:title contains "a" or upnp:artist contains "a" or dc:creator contains "a") StartingIndex=4000 RequestedCount=2000 Filter=* SortCriteria=
09:31:37.466 Thread-11:  SearchCriteria=upnp:class derivedfrom "object.item.audioItem" and (dc:title contains "a" or upnp:artist contains "a" or dc:creator contains "a") StartingIndex=6000 RequestedCount=2000 Filter=* SortCriteria=
09:31:40.879 Thread-5:  SearchCriteria=upnp:class derivedfrom "object.item.audioItem" and (dc:title contains "a" or upnp:artist contains "a" or dc:creator contains "a") StartingIndex=8000 RequestedCount=2000 Filter=* SortCriteria=
09:31:44.512 Thread-10:  SearchCriteria=upnp:class derivedfrom "object.item.audioItem" and (dc:title contains "a" or upnp:artist contains "a" or dc:creator contains "a") StartingIndex=10000 RequestedCount=2000 Filter=* SortCriteria=
09:31:48.540 Thread-10:  SearchCriteria=upnp:class derivedfrom "object.item.audioItem" and (dc:title contains "a" or upnp:artist contains "a" or dc:creator contains "a") StartingIndex=12000 RequestedCount=2000 Filter=* SortCriteria=
09:31:53.300 Thread-11:  SearchCriteria=upnp:class derivedfrom "object.item.audioItem" and (dc:title contains "a" or upnp:artist contains "a" or dc:creator contains "a") StartingIndex=14000 RequestedCount=2000 Filter=* SortCriteria=
09:31:57.831 Thread-10:  SearchCriteria=upnp:class derivedfrom "object.item.audioItem" and (dc:title contains "a" or upnp:artist contains "a" or dc:creator contains "a") StartingIndex=16000 RequestedCount=2000 Filter=* SortCriteria=
09:32:02.795 Thread-5:  SearchCriteria=upnp:class derivedfrom "object.item.audioItem" and (dc:title contains "a" or upnp:artist contains "a" or dc:creator contains "a") StartingIndex=18000 RequestedCount=2000 Filter=* SortCriteria=
09:32:07.971 Thread-11:  SearchCriteria=upnp:class derivedfrom "object.item.audioItem" and (dc:title contains "a" or upnp:artist contains "a" or dc:creator contains "a") StartingIndex=20000 RequestedCount=2000 Filter=* SortCriteria=
09:32:13.602 Thread-11:  SearchCriteria=upnp:class derivedfrom "object.item.audioItem" and (dc:title contains "a" or upnp:artist contains "a" or dc:creator contains "a") StartingIndex=22000 RequestedCount=2000 Filter=* SortCriteria=
09:32:19.959 Thread-10:  SearchCriteria=upnp:class derivedfrom "object.item.audioItem" and (dc:title contains "a" or upnp:artist contains "a" or dc:creator contains "a") StartingIndex=24000 RequestedCount=2000 Filter=* SortCriteria=
09:32:26.242 Thread-10:  SearchCriteria=upnp:class derivedfrom "object.item.audioItem" and (dc:title contains "a" or upnp:artist contains "a" or dc:creator contains "a") StartingIndex=26000 RequestedCount=2000 Filter=* SortCriteria=
09:32:32.187 Thread-5:  SearchCriteria=upnp:class derivedfrom "object.item.audioItem" and (dc:title contains "a" or upnp:artist contains "a" or dc:creator contains "a") StartingIndex=27095 RequestedCount=2000 Filter=* SortCriteria=

# d
09:31:25.344 Thread-5:  SearchCriteria=upnp:class derivedfrom "object.item.audioItem" and (dc:title contains "ad" or upnp:artist contains "ad" or dc:creator contains "ad") StartingIndex=0 RequestedCount=2000 Filter=* SortCriteria=
09:31:28.684 Thread-5:  NumberReturned=2000 TotalMatches=2564 UpdateID=393
09:31:29.908 Thread-11:  SearchCriteria=upnp:class derivedfrom "object.item.audioItem" and (dc:title contains "ad" or upnp:artist contains "ad" or dc:creator contains "ad") StartingIndex=2000 RequestedCount=2000 Filter=* SortCriteria=
09:31:32.439 Thread-5:  SearchCriteria=upnp:class derivedfrom "object.item.audioItem" and (dc:title contains "ad" or upnp:artist contains "ad" or dc:creator contains "ad") StartingIndex=2564 RequestedCount=2000 Filter=* SortCriteria=

# e
09:31:25.636 Thread-11:  SearchCriteria=upnp:class derivedfrom "object.item.audioItem" and (dc:title contains "ade" or upnp:artist contains "ade" or dc:creator contains "ade") StartingIndex=0 RequestedCount=2000 Filter=* SortCriteria=
09:31:26.859 Thread-11:  NumberReturned=384 TotalMatches=384 UpdateID=393
09:31:27.224 Thread-11:  SearchCriteria=upnp:class derivedfrom "object.item.audioItem" and (dc:title contains "ade" or upnp:artist contains "ade" or dc:creator contains "ade") StartingIndex=384 RequestedCount=2000 Filter=* SortCriteria=

# l
09:31:25.788 Thread-12:  SearchCriteria=upnp:class derivedfrom "object.item.audioItem" and (dc:title contains "adel" or upnp:artist contains "adel" or dc:creator contains "adel") StartingIndex=0 RequestedCount=2000 Filter=* SortCriteria=
09:31:26.311 Thread-12:  NumberReturned=99 TotalMatches=99 UpdateID=393
09:31:26.860 Thread-12:  SearchCriteria=upnp:class derivedfrom "object.item.audioItem" and (dc:title contains "adel" or upnp:artist contains "adel" or dc:creator contains "adel") StartingIndex=99 RequestedCount=2000 Filter=* SortCriteria=

# e
09:31:26.431 Thread-12:  SearchCriteria=upnp:class derivedfrom "object.item.audioItem" and (dc:title contains "adele" or upnp:artist contains "adele" or dc:creator contains "adele") StartingIndex=0 RequestedCount=2000 Filter=* SortCriteria=
09:31:26.796 Thread-12:  NumberReturned=90 TotalMatches=90 UpdateID=393
09:31:26.989 Thread-12:  SearchCriteria=upnp:class derivedfrom "object.item.audioItem" and (dc:title contains "adele" or upnp:artist contains "adele" or dc:creator contains "adele") StartingIndex=90 RequestedCount=2000 Filter=* SortCriteria=
NOTE: The above listing is sorted by search term so it's easier to follow, but these searches/results are all threaded.

To summarise, the result of typing:
'a' resulted in 27,095 results
'ad' resulted in 2,564 results
'ade' resulted in 384 results
'adel' resulted in 99 results
'adele' resulted in 99 results

Whilst the view from the WiiM app might not look that bad the results take over a minute to complete, mainly because there's a huge amount of xml being returned for each of the 30,241 matches, 99.6% of which are being discarded.

If you select 'Artists' then the search term is correctly modified, but traditional UPnP control points don't work this way, plus you might actually want to search for a song title.

I'd suggest if you have to provide realtime feedback then you wait until at least three letters have been typed, this alone would have reduced the results from 30,241 to 582, but is still more than the 99 required.
 
But more seriously, a small delay before searching to allow for another letter to be typed might help too.
A bit like a keyboard auto repeat delay.
 
But more seriously, a small delay before searching to allow for another letter to be typed might help too.
A bit like a keyboard auto repeat delay.
I did think of that but it's probably more difficult to implement, and you probably shouldn't ever be allowed to search for a term containing less than 3 characters - apart from ZZ ;)
Implementing the delay and limit would be best.
 
Doesn't the speed of this depend entirely on whether the server has created an indexed cache?
 
Doesn't the speed of this depend entirely on whether the server has created an indexed cache?
I'm not sure it'll help much on a single character search term (MinimServer took 3.5 seconds to perform the search across 31k items over a number of tags whilst also starting, and nearly completing, the other searches), it's building the XML and sending it over the network that takes most of the time.
 
Last edited:
Yeah, I was never too keen on U2 ;)
Although, I did quite like some FM.
How about if Songs is selected you're restricted to 3....and even if there are songs less than 3 characters in length the search still shouldn't be allowed, or has to be manually submitted.
 
I'm not sure it'll help much on a single character search term (MinimServer took 3.5 seconds to perform the search across 31k items over a number of tags whilst also starting, and nearly completing, the other searches), it's building the XML and sending it over the network that takes most of the time.
Agreed. LMS (in Material) starts at 2 characters but on my set up is virtually instant as there is a full text index in a cache.

LMS
A does nothing
Ad produces results and displays 10/26 with the top one being Adele in about a second
 
Agreed. LMS (in Material) starts at 2 characters but on my set up is virtually instant as there is a full text index in a cache.

LMS
A does nothing
Ad produces results and displays 10/26 with the top one being Adele in about a second
Does that load a page of results to the GUI at a time (is that the 10/26)?
WiiM pulls all the results 2000 at a time.
 
This is the Search facility

A picture paints a thousand words ....
Each additional character you type changes the display accordingly

Edit. Clicking on (10/26) produces all 26 results

1705408716685.png
 
This is the Search facility

A picture paints a thousand words ....
Each additional character you type changes the display accordingly

Edit. Clicking on (10/26) produces all 26 results

BubbleUPnP categorises in a similar way, and WiiM should follow suit. Rather than search for:
Code:
SearchCriteria=upnp:class derivedfrom "object.item.audioItem" and (dc:title contains "a" or upnp:artist contains "a" or dc:creator contains "a") StartingIndex=0 RequestedCount=2000 Filter=* SortCriteria=
Which pulls from a number of tags and includes OR's (shouldn't it just be dc:title in Songs), BubbleUPnP performs 7 searches (1 is for video content) only requesting 16 results at a time and produces the following results.

BubbleUPnPSearchResults.jpg

I might ask if BubbleUPnP can present the first 10 of each category like LMS does as the data has been delivered:)

With BubbleUPnP only requesting 16 items and the queries enabling the use of indexes all the results are completed by MinimServer in less than 0.2 seconds (probably a bit over a second realtime in the app).

Code:
12:49:02.346 Thread-12:  SearchCriteria=(upnp:class = "object.container.person.musicArtist" and dc:title contains "ad") StartingIndex=0 RequestedCount=16 Filter=* SortCriteria=
12:49:02.473 Thread-12:  NumberReturned=16 TotalMatches=147 UpdateID=393

12:49:02.346 Thread-10:  SearchCriteria=(upnp:class = "object.container.album.musicAlbum" and upnp:artist contains "ad") StartingIndex=0 RequestedCount=16 Filter=* SortCriteria=
12:49:02.361 Thread-10:  NumberReturned=16 TotalMatches=53 UpdateID=393

12:49:02.346 Thread-5:  SearchCriteria=(upnp:class = "object.container.album.musicAlbum" and dc:title contains "ad") StartingIndex=0 RequestedCount=16 Filter=* SortCriteria=
12:49:02.384 Thread-5:  NumberReturned=16 TotalMatches=89 UpdateID=393

12:49:02.351 Thread-11:  SearchCriteria=(upnp:class derivedfrom "object.item.audioItem" and dc:title contains "ad") StartingIndex=0 RequestedCount=16 Filter=* SortCriteria=
12:49:02.424 Thread-11:  NumberReturned=16 TotalMatches=1463 UpdateID=393

12:49:02.432 Thread-5:  SearchCriteria=(upnp:class derivedfrom "object.item.audioItem" and (dc:creator contains "ad" or upnp:artist contains "ad")) StartingIndex=0 RequestedCount=16 Filter=* SortCriteria=
12:49:02.488 Thread-5:  NumberReturned=16 TotalMatches=1155 UpdateID=393

12:49:02.483 Thread-11:  SearchCriteria=(upnp:class derivedfrom "object.item.videoItem" and dc:title contains "ad") StartingIndex=0 RequestedCount=16 Filter=* SortCriteria=
12:49:02.487 Thread-11:  NumberReturned=0 TotalMatches=0 UpdateID=393

12:49:02.504 Thread-11:  SearchCriteria=(upnp:class = "object.container.playlistContainer" and dc:title contains "ad") StartingIndex=0 RequestedCount=16 Filter=* SortCriteria=
12:49:02.507 Thread-11:  NumberReturned=2 TotalMatches=2 UpdateID=393
 
Last edited:
Back
Top