jellyfin-plugin-playbackreporting icon indicating copy to clipboard operation
jellyfin-plugin-playbackreporting copied to clipboard

Playback Reporting plugin breaks dashboard restart button

Open solidsnake1298 opened this issue 1 year ago • 2 comments

When the playback reporting plugin is installed, when a restart from the dashboard is initiated it causes the server to fail to restart. The resulting error appears in the log.

[2024-07-10 17:59:33.475 +00:00] [FTL] Error while starting server
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 8: 'attempt to write a readonly database'.
   at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
   at Emby.Server.Implementations.Data.SqliteExtensions.Execute(SqliteConnection sqliteConnection, String commandText)
   at Emby.Server.Implementations.Data.ManagedConnection.Execute(String commandText)
   at Emby.Server.Implementations.Data.BaseSqliteRepository.Initialize()
   at Emby.Server.Implementations.Data.SqliteItemRepository.Initialize()
   at Emby.Server.Implementations.ApplicationHost.InitializeServices()
   at Jellyfin.Server.Program.StartServer(IServerApplicationPaths appPaths, StartupOptions options, IConfiguration startupConfig)

Uninstalling the plugin resolved the issue. I was able to re-produce the problem when I re-installed the plugin.

Ubuntu 24.04 - bare metal Jellyfin 10.9.7 - package install

I was also able to replicate on a Docker instance I have for testing.

solidsnake1298 avatar Jul 10 '24 18:07 solidsnake1298

I was able to produce and reproduce the problem also by activating and deactivating the plugin.

p37307 avatar Jul 10 '24 18:07 p37307

One thing I noticed was that a package install directly on Ubuntu will not attempt to restart after the fatal database error. But the docker instance will restart again and appears to recover on its own.

solidsnake1298 avatar Jul 10 '24 18:07 solidsnake1298

I added Restart = always to the systemd service because the generic linux install guide mentioned it and the docker guide also. This remedies the symptoms but not the cause

bin101 avatar Oct 10 '24 13:10 bin101

I have the same issue, also reported here.

minoskt avatar Nov 10 '24 10:11 minoskt

For me this problem only seems to arise when you update the Jellyfin server version. So another work around is disable the plugin before updating Jellyfin server, restart server, update jellyfin server, restart server, enable plugin, and restart server. Now the plugin should no longer prevent restarts.

If you are currently experiencing the issue, try following the above instructions (minus the jellyfin server udpate) and it may resolve the issue until you update jellyfin server again.

ethaldeman avatar Nov 18 '24 22:11 ethaldeman

Disable then restart server and it should update the plugin to 15.0.0.0 from 14.0.0.0

Hello-World-Traveler avatar Nov 25 '24 05:11 Hello-World-Traveler

That worked! Thank you for your help.

minoskt avatar Nov 25 '24 14:11 minoskt

But 15.0.0.0 still has this issue

bin101 avatar Nov 26 '24 08:11 bin101

Playback Reporting was breaking the restart of the server. NO plugin should stop the server from booting. I had it fixed but after a few weeks it stopped restarting.

Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 5: 'database is locked For more information on this error code see https://www.sqlite.org/rescode.html'.
   at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
   at Microsoft.Data.Sqlite.SqliteConnection.Deactivate()
   at Microsoft.Data.Sqlite.SqliteConnection.Close()
   at System.Data.Common.DbConnection.CloseAsync()
--- End of stack trace from previous location ---
   at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.CloseAsync()
   at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.CloseAsync()
   at Microsoft.EntityFrameworkCore.Storage.RelationalDataReader.DisposeAsync()
   at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync[TSource](IQueryable`1 source, CancellationToken cancellationToken)
   at Jellyfin.Server.Implementations.Trickplay.TrickplayManager.GetTrickplayResolutions(Guid itemId)
   at Jellyfin.Server.Implementations.Trickplay.TrickplayManager.GetTrickplayResolutions(Guid itemId)
   at Jellyfin.Server.Implementations.Trickplay.TrickplayManager.GetTrickplayManifest(BaseItem item)
   at Emby.Server.Implementations.Dto.DtoService.AttachBasicFields(BaseItemDto dto, BaseItem item, BaseItem owner, DtoOptions options)
   at Emby.Server.Implementations.Dto.DtoService.GetBaseItemDtoInternal(BaseItem item, DtoOptions options, User user, BaseItem owner)
   at Jellyfin.Api.Controllers.UserLibraryController.GetItem(Nullable`1 userId, Guid itemId)
   at lambda_method1194(Closure, Object)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Jellyfin.Api.Middleware.ServerStartupMessageMiddleware.Invoke(HttpContext httpContext, IServerApplicationHost serverApplicationHost, ILocalizationManager localizationManager)
   at Jellyfin.Api.Middleware.WebSocketHandlerMiddleware.Invoke(HttpContext httpContext, IWebSocketManager webSocketManager)
   at Jellyfin.Api.Middleware.IPBasedAccessValidationMiddleware.Invoke(HttpContext httpContext, INetworkManager networkManager)
   at Jellyfin.Api.Middleware.LanFilteringMiddleware.Invoke(HttpContext httpContext, INetworkManager networkManager, IServerConfigurationManager serverConfigurationManager)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Jellyfin.Api.Middleware.QueryStringDecodingMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.ReDoc.ReDocMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Jellyfin.Api.Middleware.RobotsRedirectionMiddleware.Invoke(HttpContext httpContext)
   at Jellyfin.Api.Middleware.LegacyEmbyRouteRewriteMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.InvokeCore(HttpContext context)
   at Jellyfin.Api.Middleware.ResponseTimeMiddleware.Invoke(HttpContext context, IServerConfigurationManager serverConfigurationManager)
   at Jellyfin.Api.Middleware.ExceptionMiddleware.Invoke(HttpContext context)

[ERR] An error occurred using the connection to database '"main"' on server '"/var/lib/jellyfin/data/jellyfin.db"'.
[ERR] An exception occurred while iterating over the results of a query for context type '"Jellyfin.Server.Implementations.JellyfinDbContext"'."
""Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 5: 'not an error'.
   at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
   at Microsoft.Data.Sqlite.SqliteConnection.Open()
   at System.Data.Common.DbConnection.OpenAsync(CancellationToken cancellationToken)
--- End of stack trace from previous location ---
   at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenInternalAsync(Boolean errorsExpected, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenInternalAsync(Boolean errorsExpected, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenAsync(CancellationToken cancellationToken, Boolean errorsExpected)
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.AsyncEnumerator.InitializeReaderAsync(AsyncEnumerator enumerator, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.AsyncEnumerator.MoveNextAsync()"
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 5: 'not an error'.
   at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
   at Microsoft.Data.Sqlite.SqliteConnection.Open()
   at System.Data.Common.DbConnection.OpenAsync(CancellationToken cancellationToken)
--- End of stack trace from previous location ---
   at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenInternalAsync(Boolean errorsExpected, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenInternalAsync(Boolean errorsExpected, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenAsync(CancellationToken cancellationToken, Boolean errorsExpected)
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.AsyncEnumerator.InitializeReaderAsync(AsyncEnumerator enumerator, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.AsyncEnumerator.MoveNextAsync()
   at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleOrDefaultAsync[TSource](IAsyncEnumerable`1 asyncEnumerable, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleOrDefaultAsync[TSource](IAsyncEnumerable`1 asyncEnumerable, CancellationToken cancellationToken)
   at Jellyfin.Server.Implementations.Security.AuthorizationContext.GetAuthorizationInfoFromDictionary(Dictionary`2 auth, IHeaderDictionary headers, IQueryCollection queryString)
   at Jellyfin.Server.Implementations.Security.AuthorizationContext.GetAuthorizationInfoFromDictionary(Dictionary`2 auth, IHeaderDictionary headers, IQueryCollection queryString)
   at Jellyfin.Server.Implementations.Security.AuthorizationContext.GetAuthorizationInfo(HttpRequest requestContext)

This was in the log, not sure if it's the cause. Trickplay error?

I think this should be moved to Jellyfin server issues? @Bond-009 @thornbill

Hello-World-Traveler avatar Jan 01 '25 20:01 Hello-World-Traveler

Don't ping random team members

thornbill avatar Jan 02 '25 01:01 thornbill

@thornbill I wasn't random. I have notice both of you around (outside Server and web UI) sometimes doing admin work. I am sorry I pinged you in this manner.

Hello-World-Traveler avatar Jan 02 '25 02:01 Hello-World-Traveler

I believe this issue still exists. Able to replicate it on unraid v7.0.1 using Jellyfin v10.10.7 and Playback Reporting v16.0.0.0

2dee11 avatar Apr 17 '25 21:04 2dee11

Still an active bug

    at Emby.Server.Implementations.Data.ManagedConnection.Execute(String commandText)
    at Emby.Server.Implementations.Data.BaseSqliteRepository.Initialize()
    at Emby.Server.Implementations.Data.SqliteItemRepository.Initialize()
    at Emby.Server.Implementations.ApplicationHost.InitializeServices()
    at Jellyfin.Server.Program.StartServer(IServerApplicationPaths appPaths, StartupOptions options, IConfiguration sta>
  [INF] Running query planner optimizations in the database... This might take a while
  [INF] Disposing CoreAppHost
  [INF] Disposing PluginManager
 systemd[1]: jellyfin.service: Deactivated successfully.

Hello-World-Traveler avatar Apr 25 '25 22:04 Hello-World-Traveler

I believe this issue still exists. Able to replicate it on unraid v7.0.1 using Jellyfin v10.10.7 and Playback Reporting v16.0.0.0

it very much does still exist. with the plugin enabled, restarting jellyfin via the webui fails.

chenks avatar Jun 02 '25 13:06 chenks

Try shutting down jf completly then delete any leftover folders of the plugin of pre v16.0.0.0 versions in the plugin dir and then do a cold start of jf. Never ever had the issue since v16.0.0.0

bin101 avatar Jun 02 '25 13:06 bin101

Try shutting down jf completly then delete any leftover folders of the plugin of pre v16.0.0.0 versions in the plugin dir and then do a cold start of jf. Never ever had the issue since v16.0.0.0

in /var/lib/jellyfin/plugins, which folders would be leftover? my JF instance is a proxmox ubuntu container.

Image

chenks avatar Jun 02 '25 13:06 chenks

'Playback Reporting_15.0.0.0' in your case

bin101 avatar Jun 02 '25 13:06 bin101

guess i'm missing something obvious. have stopped the jellyfind service

then used rm -rf /var/lib/jellyfin/plugins/Playback\ Reporting_15.0.0.0/*, however there are no errors but the folder does not delete.

chenks avatar Jun 02 '25 13:06 chenks

remove the asterix, with it you will just delete the files inside the folder

bin101 avatar Jun 02 '25 13:06 bin101

remove the asterix, with it you will just delete the files inside the folder

removing the old plugin folders hasn't made any difference. restarting jellyfin from the dashboard UI still fails.

chenks avatar Jun 02 '25 13:06 chenks

For completeness (as this was the original reported issue for this problem), there are a few more of us in #96 who have noted that the fix in 16.0.0.0 doesn't seem to have helped.

Terrance avatar Jun 19 '25 18:06 Terrance