2123-2126: getCurrentTrack exception

Report bugs & feature requests for MediaMonkey 5 and learn about the newest builds.

Moderator: Gurus

TIV73
Posts: 97
Joined: Sat Nov 12, 2011 1:31 pm

2123-2126: getCurrentTrack exception

Post by TIV73 » Sun Oct 07, 2018 9:40 am

Hi everyone,
I'm currently working on MediMonkeyNet which is a C# library that reads information from MM5 and allows (rudimentary) remote control via javascript commands. It does so by opening a web socket to the chromium engine running MediaMonkey and then uses the Chrome DevTools Protocol to send javascript to MM.

With this I am able to trigger an exception in MediaMonkey if I send an app.player.getCurrentTrack() command. Now, since the exception only occurs if the command is sent from an external source it might very well be an issue on the side of my library. What makes me sceptical is the very specific set of conditions that is needed to trigger the issue.
Since the exception is thrown by the mediamonkey engine and not the chromium frontend I'm unable to really debug or even verify the issue, so I can't be sure what the actual problem is.

The exception can be triggered with the following steps:
- Start mediamonkey
- Play a song
- Click the 'Next' button to play the next song
- Send app.player.getCurrentTrack() -> exception

There are a couple of conditions that need to be met in order to trigger the exception:
- The exception only occurs in (public) revisions since 2123. In 2120 the same steps work perfectly fine.
- The exception only occurs if the comment property of the selected song is empty.
- The exception only occurs if the track is changed by clicking the 'Next' button while the MM is in full mode. The mini player works fine, as does changing the track by double clicking a song in the song list.

The problem seems to be exclusive to retrieving data about the currently playing track, other commands (e.g. app.currentSkin()) work fine, I therefore believe that it's somehow related to reading the track comment. The last couple of lines in the strack trace also seem to support this:

Code: Select all

;
; Line=9180 - Offset=30
; ---------------------
0140F706  B8A4F74001  MOV  EAX, $0140F7A4 ; ($0140F7A4) BaseMedia.TSongListData.getCommentSync (Line=9182) UNICODE: 'Long texts not loaded, use getCommentAsync version'  ; <-- EXCEPTION
0140F70B  E8A8A3FFFE  CALL -$01005C58     ; ($00409AB8) System._Assert
I triggered the exception a couple of times, the ID of the log is 9EDAEA7D.

Could somebody provide insight into this problem? I'd be grateful for any pointers.

PetrCBR
Posts: 1667
Joined: Tue Mar 07, 2006 5:31 pm
Location: Czech
Contact:

Re: 2123-2126: getCurrentTrack exception

Post by PetrCBR » Sun Oct 07, 2018 2:04 pm

Are you sure you are not accessing commentSync property of the track ? As i see we're accesing this property from mediaSync.js.

TIV73
Posts: 97
Joined: Sat Nov 12, 2011 1:31 pm

Re: 2123-2126: getCurrentTrack exception

Post by TIV73 » Sun Oct 07, 2018 3:22 pm

Considering the error message, I'm pretty sure that something tries to access the commentSync property, but it's not me - at least not explicitly. The string I'm passing via Runtime.Evaluate to trigger the exception is

Code: Select all

{
  "expression": "app.player.getCurrentTrack()",
  "objectGroup": "console",
  "includeCommandLineAPI": true,
  "silent": false,
  "returnByValue": true,
  "awaitPromise": true
}
Before that I'm not sending any other commands to MM.

What really confuses me is that the problem doesn't actually seem to be related to getCurrentTrack, at least not by itself. If I start a song by double clicking it, the command works fine. The exception only occurs if I change the playing track by clicking the next file button or waiting until the current song finishes.
I can also prevent the exception by "preloading" the comment property before calling getCurrentTrack remotely, either by calling the same command from within MediaMonkey or by opening the properties dialog for the playing track.

Ludek
Posts: 3373
Joined: Fri Mar 09, 2007 9:00 am

Re: 2123-2126: getCurrentTrack exception

Post by Ludek » Mon Oct 08, 2018 7:44 am

Hi, my idea is that the Chrome's DevTools Protocol could evaluate track.commentSync property that would result in the assertion? I guess the same happens when you have a breakpoint in devtools and hover over a track object to see the properties, it tries to evaluate it and asserts the same way.
I will modify it and will replace the property by the function for the next build.
It should resolve the issue.
=> Fixed in 2127

Thanks for reporting!

TIV73
Posts: 97
Joined: Sat Nov 12, 2011 1:31 pm

Re: 2123-2126: getCurrentTrack exception

Post by TIV73 » Mon Oct 08, 2018 3:17 pm

This makes sense, the result of the call is returned as json object, so at some point there needs to be an (implicit) evaluation of all object properties. I can verify this by storing the result of getCurrentTrack in a variable and returning it in a separate call, as opposed to directly returning the result of the original call:

Code: Select all

await SendCommandAsync("var sd = app.player.getCurrentTrack();"); //OK
await SendCommandAsync("var mmnetTrack=e=>e;"); // OK
RemoteObject track = (await SendCommandAsync("mmnetTrack(sd);")).Result; // Exception
Thanks a lot for the response, can't wait to try the next revision!

Post Reply