Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

500 error on my playlists, causes client breakage #853

Closed
moviuro opened this issue May 3, 2021 · 6 comments
Closed

500 error on my playlists, causes client breakage #853

moviuro opened this issue May 3, 2021 · 6 comments
Labels

Comments

@moviuro
Copy link

moviuro commented May 3, 2021

Hi,

My client (Ultrasonic on Android) experiences some breakage due to playlists returning some NULL files?... Here is the nextcloud log snippet from /usr/local/www/nextcloud/data/nextcloud.log:

{
  "reqId": "6du2063P3gE9ZHrWYAA9",
  "level": 3,
  "time": "2021-05-02T21:12:17+00:00",
  "remoteAddr": "10.21.10.12",
  "user": "--",
  "app": "index",
  "method": "GET",
  "url": "/apps/music/subsonic/rest/getPlaylist.view?id=4&u=moviuro&c=Ultrasonic&f=json&v=1.11.0&p=enc:3xxxxxxxxxxxxxx7",
  "message": {
    "Exception": "Exception",
    "Message": "OCA\\Music\\AppFramework\\BusinessLayer\\BusinessLayer::findOrDefault(): Argument #1 ($id) must be of type int, null given, called in /usr/local/www/nextcloud/apps/music/lib/Controller/SubsonicController.php on line 1126",
    "Code": 0,
    "Trace": [
      {
        "file": "/usr/local/www/nextcloud/lib/private/AppFramework/App.php",
        "line": 157,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          {
            "__class__": "OCA\\Music\\Controller\\SubsonicController"
          },
          "handleRequest"
        ]
      },
      {
        "file": "/usr/local/www/nextcloud/lib/private/Route/Router.php",
        "line": 302,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::",
        "args": [
          "SubsonicController",
          "handleRequest",
          {
            "__class__": "OC\\AppFramework\\DependencyInjection\\DIContainer"
          },
          {
            "method": "getPlaylist.view",
            "_route": "music.subsonic.handleRequest"
          }
        ]
      },
      {
        "file": "/usr/local/www/nextcloud/lib/base.php",
        "line": 993,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->",
        "args": [
          "/apps/music/subsonic/rest/getPlaylist.view"
        ]
      },
      {
        "file": "/usr/local/www/nextcloud/index.php",
        "line": 37,
        "function": "handleRequest",
        "class": "OC",
        "type": "::",
        "args": []
      }
    ],
    "File": "/usr/local/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
    "Line": 159,
    "Previous": {
      "Exception": "TypeError",
      "Message": "OCA\\Music\\AppFramework\\BusinessLayer\\BusinessLayer::findOrDefault(): Argument #1 ($id) must be of type int, null given, called in /usr/local/www/nextcloud/apps/music/lib/Controller/SubsonicController.php on line 1126",
      "Code": 0,
      "Trace": [
        {
          "file": "/usr/local/www/nextcloud/apps/music/lib/Controller/SubsonicController.php",
          "line": 1126,
          "function": "findOrDefault",
          "class": "OCA\\Music\\AppFramework\\BusinessLayer\\BusinessLayer",
          "type": "->",
          "args": [
            null,
            "moviuro"
          ]
        },
        {
          "function": "trackToApi",
          "class": "OCA\\Music\\Controller\\SubsonicController",
          "type": "->",
          "args": [
            {
              "title": null,
              "number": null,
              "disk": null,
              "year": null,
              "artistId": null,
              "albumId": null,
              "length": null,
              "fileId": null,
              "bitrate": null,
              "uri": null,
              "mimetype": null,
              "userId": null,
              "mbid": null,
              "starred": null,
              "genreId": null,
              "created": null,
              "updated": null,
              "filename": null,
              "size": null,
              "albumName": null,
              "artistName": null,
              "genreName": null,
              "album": null,
              "numberOnPlaylist": null,
              "id": 2295,
              "__class__": "OCA\\Music\\Db\\Track"
            }
          ]
        },
        {
          "file": "/usr/local/www/nextcloud/apps/music/lib/Controller/SubsonicController.php",
          "line": 526,
          "function": "array_map",
          "args": [
            [
              {
                "__class__": "OCA\\Music\\Controller\\SubsonicController"
              },
              "trackToApi"
            ],
            [
              {
                "title": "13",
                "number": 6,
                "disk": 1,
                "year": 2012,
                "artistId": 6435,
                "albumId": 3241,
                "length": 308,
                "fileId": 4306,
                "bitrate": 206056,
                "uri": null,
                "mimetype": "audio/mpeg",
                "userId": "moviuro",
                "mbid": null,
                "starred": "2020-07-08 08:44:34",
                "genreId": 41369,
                "created": "2021-02-21 09:25:23",
                "updated": "2021-02-21 09:25:23",
                "filename": "06 13.mp3",
                "size": 7984149,
                "albumName": "In noxa est",
                "artistName": "Obsidian Shell",
                "genreName": "Unknown",
                "album": {
                  "name": "In noxa est",
                  "mbid": null,
                  "disk": null,
                  "mbidGroup": null,
                  "coverFileId": 1310954,
                  "userId": "moviuro",
                  "albumArtistId": 6435,
                  "hash": "049275086e3494e7623ef7c2f9e16df8",
                  "starred": null,
                  "created": "2021-02-21 09:25:23",
                  "updated": "2021-03-02 03:47:08",
                  "albumArtistName": "Obsidian Shell",
                  "years": [
                    2012
                  ],
                  "genres": [
                    41369
                  ],
                  "artistIds": [
                    6435
                  ],
                  "numberOfDisks": 1,
                  "id": 3241,
                  "__class__": "OCA\\Music\\Db\\Album"
                },
                "numberOnPlaylist": 1,
                "id": 3243,
                "__class__": "OCA\\Music\\Db\\Track"
              },
              {
                "title": "Electric Blue",
                "number": 9,
                "disk": 1,
                "year": 1996,
                "artistId": 7411,
                "albumId": 3706,
                "length": 291,
                "fileId": 4883,
                "bitrate": 320000,
                "uri": null,
                "mimetype": "audio/mpeg",
                "userId": "moviuro",
                "mbid": null,
                "starred": "2020-08-05 07:53:07",
                "genreId": 41712,
                "created": "2021-02-21 09:25:23",
                "updated": "2021-02-21 09:25:23",
                "filename": "09 Electric Blue.mp3",
                "size": 11751115,
                "albumName": "To the Faithful Departed",
                "artistName": "The Cranberries",
                "genreName": "Alternative  Rock",
                "album": {
                  "name": "To the Faithful Departed",
                  "mbid": null,
                  "disk": null,
                  "mbidGroup": null,
                  "coverFileId": 4886,
                  "userId": "moviuro",
                  "albumArtistId": 7411,
                  "hash": "4724b45ea8a58d9af0a57288dc4269df",
                  "starred": null,
                  "created": "2021-02-21 09:25:23",
                  "updated": "2021-02-21 09:25:23",
                  "albumArtistName": "The Cranberries",
                  "years": [
                    1996
                  ],
                  "genres": [
                    41712
                  ],
                  "artistIds": [
                    7411
                  ],
                  "numberOfDisks": 1,
                  "id": 3706,
                  "__class__": "OCA\\Music\\Db\\Album"
                },
                "numberOnPlaylist": 2,
                "id": 3711,
                "__class__": "OCA\\Music\\Db\\Track"
              },
              {
                "title": "Modus Operandi",
                "number": 30,
                "disk": 1,
                "year": 2015,
                "artistId": 121711,
                "albumId": 59868,
                "length": 238,
                "fileId": 66027,
                "bitrate": 351568,
                "uri": null,
                "mimetype": "audio/ogg",
                "userId": "moviuro",
                "mbid": null,
                "starred": "2020-07-08 08:47:35",
                "genreId": 6,
                "created": "2021-02-21 09:25:23",
                "updated": "2021-02-21 09:25:23",
                "filename": "999 - Modus Operandi.ogg",
                "size": 10796514,
                "albumName": "fault Series ORIGINAL SOUNDTRACK vol. 1",
                "artistName": "緑坂亜綾",
                "genreName": "",
                "album": {
                  "name": "fault Series ORIGINAL SOUNDTRACK vol. 1",
                  "mbid": null,
                  "disk": null,
                  "mbidGroup": null,
                  "coverFileId": 66027,
                  "userId": "moviuro",
                  "albumArtistId": 119735,
                  "hash": "cf8087c682ae5bca4ee6d996080be58f",
                  "starred": null,
                  "created": "2021-02-21 09:25:23",
                  "updated": "2021-02-21 09:25:23",
                  "albumArtistName": "AARAS",
                  "years": [
                    2015
                  ],
                  "genres": [
                    6
                  ],
                  "artistIds": [
                    119735,
                    119785,
                    121711
                  ],
                  "numberOfDisks": 1,
                  "id": 59868,
                  "__class__": "OCA\\Music\\Db\\Album"
                },
                "numberOnPlaylist": 3,
                "id": 6743,
                "__class__": "OCA\\Music\\Db\\Track"
              },
              {
                "title": "Tough & Alone",
                "number": 6,
                "disk": 1,
                "year": 2017,
                "artistId": 2821,
                "albumId": 1411,
                "length": 237,
                "fileId": 2166,
                "bitrate": 312890,
                "uri": null,
                "mimetype": "audio/mpeg",
                "userId": "moviuro",
                "mbid": null,
                "starred": "2020-07-09 08:26:42",
                "genreId": 39651,
                "created": "2021-02-21 09:25:23",
                "updated": "2021-02-21 09:25:23",
                "filename": "06 - Tough & Alone.mp3",
                "size": 9379193,
                "albumName": "eYe's",
                "artistName": "MYTH & ROID",
                "genreName": "JPop",
                "album": {
                  "name": "eYe's",
                  "mbid": null,
                  "disk": null,
                  "mbidGroup": null,
                  "coverFileId": 2166,
                  "userId": "moviuro",
                  "albumArtistId": 2821,
                  "hash": "2e535f0956ad431ed151c95ed9eb1712",
                  "starred": null,
                  "created": "2021-02-21 09:25:23",
                  "updated": "2021-02-21 09:25:23",
                  "albumArtistName": "MYTH & ROID",
                  "years": [
                    2017
                  ],
                  "genres": [
                    39651
                  ],
                  "artistIds": [
                    2821
                  ],
                  "numberOfDisks": 1,
                  "id": 1411,
                  "__class__": "OCA\\Music\\Db\\Album"
                },
                "numberOnPlaylist": 4,
                "id": 6657,
                "__class__": "OCA\\Music\\Db\\Track"
              },
              {
                "title": "abnormalize",
                "number": 2,
                "disk": 1,
                "year": 2013,
                "artistId": 30189,
                "albumId": 15095,
                "length": 217,
                "fileId": 316295,
                "bitrate": 272406,
                "uri": null,
                "mimetype": "audio/mpeg",
                "userId": "moviuro",
                "mbid": null,
                "starred": "2020-07-08 06:05:18",
                "genreId": 6,
                "created": "2021-02-21 09:25:23",
                "updated": "2021-02-21 09:25:23",
                "filename": "02. abnormalize.mp3",
                "size": 7452515,
                "albumName": "i'mperfect",
                "artistName": "凛として時雨",
                "genreName": "",
                "album": {
                  "name": "i'mperfect",
                  "mbid": null,
                  "disk": null,
                  "mbidGroup": null,
                  "coverFileId": 316302,
                  "userId": "moviuro",
                  "albumArtistId": 30189,
                  "hash": "e1f82d2e67a765c3cf0761f70d9955c2",
                  "starred": null,
                  "created": "2021-02-21 09:25:23",
                  "updated": "2021-02-21 09:25:23",
                  "albumArtistName": "凛として時雨",
                  "years": [
                    2013
                  ],
                  "genres": [
                    6
                  ],
                  "artistIds": [
                    30189
                  ],
                  "numberOfDisks": 1,
                  "id": 15095,
                  "__class__": "OCA\\Music\\Db\\Album"
                },
                "numberOnPlaylist": 5,
                "id": 15096,
                "__class__": "OCA\\Music\\Db\\Track"
              },
              "And 179 more entries, set log level to debug to see all entries"
            ]
          ]
        },
        {
          "file": "/usr/local/www/nextcloud/apps/music/lib/Controller/SubsonicController.php",
          "line": 156,
          "function": "getPlaylist",
          "class": "OCA\\Music\\Controller\\SubsonicController",
          "type": "->",
          "args": []
        },
        {
          "file": "/usr/local/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 218,
          "function": "handleRequest",
          "class": "OCA\\Music\\Controller\\SubsonicController",
          "type": "->",
          "args": [
            "getPlaylist"
          ]
        },
        {
          "file": "/usr/local/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 127,
          "function": "executeController",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->",
          "args": [
            {
              "__class__": "OCA\\Music\\Controller\\SubsonicController"
            },
            "handleRequest"
          ]
        },
        {
          "file": "/usr/local/www/nextcloud/lib/private/AppFramework/App.php",
          "line": 157,
          "function": "dispatch",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->",
          "args": [
            {
              "__class__": "OCA\\Music\\Controller\\SubsonicController"
            },
            "handleRequest"
          ]
        },
        {
          "file": "/usr/local/www/nextcloud/lib/private/Route/Router.php",
          "line": 302,
          "function": "main",
          "class": "OC\\AppFramework\\App",
          "type": "::",
          "args": [
            "SubsonicController",
            "handleRequest",
            {
              "__class__": "OC\\AppFramework\\DependencyInjection\\DIContainer"
            },
            {
              "method": "getPlaylist.view",
              "_route": "music.subsonic.handleRequest"
            }
          ]
        },
        {
          "file": "/usr/local/www/nextcloud/lib/base.php",
          "line": 993,
          "function": "match",
          "class": "OC\\Route\\Router",
          "type": "->",
          "args": [
            "/apps/music/subsonic/rest/getPlaylist.view"
          ]
        },
        {
          "file": "/usr/local/www/nextcloud/index.php",
          "line": 37,
          "function": "handleRequest",
          "class": "OC",
          "type": "::",
          "args": []
        }
      ],
      "File": "/usr/local/www/nextcloud/apps/music/lib/AppFramework/BusinessLayer/BusinessLayer.php",
      "Line": 93
    },
    "CustomMessage": "--"
  },
  "userAgent": "okhttp/3.12.13",
  "version": "21.0.1.1"
}
@paulijar
Copy link
Collaborator

paulijar commented May 3, 2021

Thanks for the report. I believe that your playlist now contains at least one track (with ID 2295) which no longer exists in your library. This sort of thing is not supposed to happen as tracks are supposed to get removed from any playlists when they are removed from the library. But I guess that some unusual circumstances could still lead to this. When you view the playlist on the Music app web UI, do you see any entries with no proper name shown?

It may be difficult to find out, what has caused the situation in the first place. But I should anyway add some sanity checks to the SubsonicController so that such stray tracks wouldn't break the playlist fetching.

@paulijar paulijar added the Bug label May 3, 2021
@moviuro
Copy link
Author

moviuro commented May 3, 2021

Yes, I did some library manipulation on disk (picard metadata edition, (re)moving files around, etc.), then used /usr/local/bin/php console.php music:scan --all. In my playlist in the web UI I can see some items with no name, no artist, etc. The right pane "loads forever".

capture where a playlist item is missing all fields

@paulijar
Copy link
Collaborator

paulijar commented May 4, 2021

Okay, that probably explains it. If you remove that track 6 from the playlist (and any others like it), then it should fix your problem. I will anyway fix the Subsonic API implementation to be less fragile on such cases. But it will of course take some time before the fixed Music app release is available.

@moviuro
Copy link
Author

moviuro commented May 4, 2021

I can confirm that removing the empty files from the playlist does fix the client.

paulijar added a commit that referenced this issue May 6, 2021
Also, set non-null values for some of the fields of the returned broken
track as the Ultrasonic client doesn't seem to tolerate null values on
all fields.

refs #853
@paulijar
Copy link
Collaborator

The fix for this problem has now been released in Music v1.2.0.

@moviuro
Copy link
Author

moviuro commented May 14, 2021

I can confirm my client no longer fails! Thanks 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants