[fixed] [MP2-786] Cannot play audio playlist with >=1000 entries (1 Viewer)

Nikki Locke

Portal Pro
February 2, 2019
468
62
72
Home Country
United Kingdom United Kingdom
MediaPortal 2 Version: 2.2

Description
I have reproduced the problem with VS2017 compiled current master branch (SHA-1: 11cc07571c5240288128e4dae4ce69b66085569c).

I have created a playlist of all my music (4860 tracks altogether), but any attempt to play it results in the following exception in the log:

[2019-02-06 17:36:00,342] [562187 ] [2 ] [ERROR] - ApplicationLauncher: Unhandled exception in application
System.AggregateException: A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread. ---> System.AggregateException: One or more errors occurred. ---> UPnP.Infrastructure.CP.UPnPException: Error invoking action 'X_MediaPortal_LoadCustomPlaylist' ---> UPnP.Infrastructure.CP.UPnPRemoteException: Action Failed
at UPnP.Infrastructure.CP.DeviceTree.CpAction.AsyncActionCallResult.GetOutParams() in E:\MediaPortal-2\MediaPortal\Source\Core\UPnP\Infrastructure\CP\DeviceTree\CpAction.cs:line 100
at UPnP.Infrastructure.CP.DeviceTree.CpAction.EndInvokeAction(IAsyncResult result) in E:\MediaPortal-2\MediaPortal\Source\Core\UPnP\Infrastructure\CP\DeviceTree\CpAction.cs:line 316
--- End of inner exception stack trace ---
at UPnP.Infrastructure.CP.DeviceTree.CpAction.EndInvokeAction(IAsyncResult result) in E:\MediaPortal-2\MediaPortal\Source\Core\UPnP\Infrastructure\CP\DeviceTree\CpAction.cs:line 320
at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at MediaPortal.Common.Services.ServerCommunication.UPnPContentDirectoryServiceProxy.<LoadCustomPlaylistAsync>d__48.MoveNext() in E:\MediaPortal-2\MediaPortal\Source\Core\MediaPortal.Common\Services\ServerCommunication\UPnPContentDirectoryServiceProxy.cs:line 501
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at System.Threading.Tasks.Task`1.get_Result()
at MediaPortal.UiComponents.Media.Models.ManagePlaylistsModel.<>c__DisplayClass47_0.<LoadPlaylist>b__1(IList`1 itemIds)
at System.Linq.Enumerable.<SelectManyIterator>d__17`2.MoveNext()
at MediaPortal.UiComponents.Media.Models.PlayItemsModel.<AsyncAddToPlaylist>d__46.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at MediaPortal.UiComponents.Media.Models.PlayItemsModel.<>c__DisplayClass47_0.<<PlayOrEnqueueItemsInternal>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at MediaPortal.UiComponents.Media.Models.PlayItemsModel.<PlayOrEnqueueItemsInternal>d__47.MoveNext()
--- End of inner exception stack trace ---
---> (Inner Exception #0) System.AggregateException: One or more errors occurred. ---> UPnP.Infrastructure.CP.UPnPException: Error invoking action 'X_MediaPortal_LoadCustomPlaylist' ---> UPnP.Infrastructure.CP.UPnPRemoteException: Action Failed
at UPnP.Infrastructure.CP.DeviceTree.CpAction.AsyncActionCallResult.GetOutParams() in E:\MediaPortal-2\MediaPortal\Source\Core\UPnP\Infrastructure\CP\DeviceTree\CpAction.cs:line 100
at UPnP.Infrastructure.CP.DeviceTree.CpAction.EndInvokeAction(IAsyncResult result) in E:\MediaPortal-2\MediaPortal\Source\Core\UPnP\Infrastructure\CP\DeviceTree\CpAction.cs:line 316
--- End of inner exception stack trace ---
at UPnP.Infrastructure.CP.DeviceTree.CpAction.EndInvokeAction(IAsyncResult result) in E:\MediaPortal-2\MediaPortal\Source\Core\UPnP\Infrastructure\CP\DeviceTree\CpAction.cs:line 320
at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at MediaPortal.Common.Services.ServerCommunication.UPnPContentDirectoryServiceProxy.<LoadCustomPlaylistAsync>d__48.MoveNext() in E:\MediaPortal-2\MediaPortal\Source\Core\MediaPortal.Common\Services\ServerCommunication\UPnPContentDirectoryServiceProxy.cs:line 501
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at System.Threading.Tasks.Task`1.get_Result()
at MediaPortal.UiComponents.Media.Models.ManagePlaylistsModel.<>c__DisplayClass47_0.<LoadPlaylist>b__1(IList`1 itemIds)
at System.Linq.Enumerable.<SelectManyIterator>d__17`2.MoveNext()
at MediaPortal.UiComponents.Media.Models.PlayItemsModel.<AsyncAddToPlaylist>d__46.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at MediaPortal.UiComponents.Media.Models.PlayItemsModel.<>c__DisplayClass47_0.<<PlayOrEnqueueItemsInternal>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at MediaPortal.UiComponents.Media.Models.PlayItemsModel.<PlayOrEnqueueItemsInternal>d__47.MoveNext()
---> (Inner Exception #0) UPnP.Infrastructure.CP.UPnPException: Error invoking action 'X_MediaPortal_LoadCustomPlaylist' ---> UPnP.Infrastructure.CP.UPnPRemoteException: Action Failed
at UPnP.Infrastructure.CP.DeviceTree.CpAction.AsyncActionCallResult.GetOutParams() in E:\MediaPortal-2\MediaPortal\Source\Core\UPnP\Infrastructure\CP\DeviceTree\CpAction.cs:line 100
at UPnP.Infrastructure.CP.DeviceTree.CpAction.EndInvokeAction(IAsyncResult result) in E:\MediaPortal-2\MediaPortal\Source\Core\UPnP\Infrastructure\CP\DeviceTree\CpAction.cs:line 316
--- End of inner exception stack trace ---
at UPnP.Infrastructure.CP.DeviceTree.CpAction.EndInvokeAction(IAsyncResult result) in E:\MediaPortal-2\MediaPortal\Source\Core\UPnP\Infrastructure\CP\DeviceTree\CpAction.cs:line 320
at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at MediaPortal.Common.Services.ServerCommunication.UPnPContentDirectoryServiceProxy.<LoadCustomPlaylistAsync>d__48.MoveNext() in E:\MediaPortal-2\MediaPortal\Source\Core\MediaPortal.Common\Services\ServerCommunication\UPnPContentDirectoryServiceProxy.cs:line 501<---
<---

Steps to Reproduce:
Have lots of music (I have 4680 tracks in my playlist, but I suspect anything over 1000 would do).

Create a playlist with lots of tracks.

Go to playlists and choose the playlist.

Click Load playlist.

Click Play audio items.

Nothing is played, and the exception above appears in the log.
 

Nikki Locke

Portal Pro
February 2, 2019
468
62
72
Home Country
United Kingdom United Kingdom
Note - I am happy to try to debug this further, and even fix it, but I don't really understand the way the clustering works, and where to put a breakpoint to find the error.
 

HTPCSourcer

Retired Team Member
  • Premium Supporter
  • May 16, 2008
    11,418
    2,335
    Home Country
    Germany Germany
    @Nikki Locke , now I start getting annoyed:
    1. We cannot accept any bug report that is based on own builds
    2. I have absolutely no problem to play a 12000 track playlist on my system.
    Use the official release and things will work. If not, upload DEBUG logs.

    Marking as No Bug.
     
    Last edited:

    Nikki Locke

    Portal Pro
    February 2, 2019
    468
    62
    72
    Home Country
    United Kingdom United Kingdom
    It happens exactly the same with the official release - sorry I didn't mention that. I only compiled my own version to try to find out what was happening, but I got lost in a twisty maze of async remote function calls.

    Interesting that it works for you (with the official release, I assume?)

    I wonder what is wrong with my system?
     

    HTPCSourcer

    Retired Team Member
  • Premium Supporter
  • May 16, 2008
    11,418
    2,335
    Home Country
    Germany Germany
    It happens exactly the same with the official release - sorry I didn't mention that.
    That would have avoided the annoyance at my side. Still, we won't be looking at custom builds in the bug section for obvious reasons.

    I wonder what is wrong with my system
    This is why we are asking for full Logs.

    At my side I can for example start with the artist view and select ''Add all to Playlist'. This adds my complete collection to the playlist, which then starts playing automatically. Does this work for you?
     

    Nikki Locke

    Portal Pro
    February 2, 2019
    468
    62
    72
    Home Country
    United Kingdom United Kingdom
    Herewith the logs. Steps used:
    Reboot machine.
    Go to Settings/System/Diagnostics/Enable DEBUG logging, and turn on
    Go to Audio/Audio/Playlists and select large playlist.
    Click Load playlist button. Rectangle (dialog) appears on screen saying "Adding items to playlist 0", then goes away again.
    Click Show audio playlist - it says <No items in playlist>
     

    Attachments

    • MediaPortal2-Logs-2019-02-07-11.03.33.zip
      1.3 MB

    Nikki Locke

    Portal Pro
    February 2, 2019
    468
    62
    72
    Home Country
    United Kingdom United Kingdom
    I guess the initial problem is at the server end:

    [ERROR] - Unable to query
    code = Error (1), message = System.Data.SQLite.SQLiteException (0x800007BF): SQL logic error
    too many SQL variables
    at System.Data.SQLite.SQLite3.Prepare(SQLiteConnection cnn, String strSql, SQLiteStatement previous, UInt32 timeoutMS, String& strRemain)
    at System.Data.SQLite.SQLiteCommand.BuildNextCommand()
    at System.Data.SQLite.SQLiteCommand.GetStatement(Int32 index)
    at System.Data.SQLite.SQLiteDataReader.NextResult()
    at System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, CommandBehavior behave)
    at System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior)
    at System.Data.SQLite.SQLiteCommand.ExecuteDbDataReader(CommandBehavior behavior)
    at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
    at MediaPortal.Backend.Services.MediaLibrary.QueryEngine.CompiledMediaItemQuery.GetMediaItems(ISQLDatabase database, ITransaction transaction, Boolean singleMode, IEnumerable`1 selectedMIAs, IList`1& mediaItemIds, IDictionary`2& complexMediaItems, Boolean forceSingleMIAMode)
    at MediaPortal.Backend.Services.MediaLibrary.QueryEngine.CompiledMediaItemQuery.Query(ISQLDatabase database, ITransaction transaction, Boolean singleMode)

    and the client end is not trapping and reporting the exception (except to the log) - but maybe that is working as designed, as an error message would not help most users.
     

    HTPCSourcer

    Retired Team Member
  • Premium Supporter
  • May 16, 2008
    11,418
    2,335
    Home Country
    Germany Germany
    Can you please try this:
    At my side I can for example start with the artist view and select ''Add all to Playlist'. This adds my complete collection to the playlist, which then starts playing automatically. Does this work for you?
     

    Nikki Locke

    Portal Pro
    February 2, 2019
    468
    62
    72
    Home Country
    United Kingdom United Kingdom
    Sorry, I thought I had replied to that one.

    Yes, I can add all my music to the currently playing playlist, and that works fine.

    But if I save that playlist as a saved playlist, and try to load it again, that causes the exception at the server end (and creates an empty audio playlist at the client end, which shows as playing in the little icon at the top left of the screen, but obviously no music happens).
     

    HTPCSourcer

    Retired Team Member
  • Premium Supporter
  • May 16, 2008
    11,418
    2,335
    Home Country
    Germany Germany
    Yes, I can add all my music to the currently playing playlist, and that works fine.
    Good. So at least this is working.

    But if I save that playlist as a saved playlist, and try to load it again, that causes the exception at the server end
    I'll try to reproduce this. You mentioned 1000+ tracks. Did you try with a small number, e.g. 20, 50, 100?
     

    Users who are viewing this thread

    Top Bottom