firecore / InfuseSync

InfuseSync is a plugin for Emby and Jellyfin media servers that tracks all media changes to decrease sync times with Infuse clients.
GNU General Public License v3.0
98 stars 10 forks source link

Sync fails constantly from AppleTV/Mac/iPhone Infuse Pro to Jellyfin #18

Closed sejmann closed 5 months ago

sejmann commented 2 years ago

Infuse on my Apple TV rarely syncs with jellyfin successfully. The initial sync after adding jellyfin connection anew succeeds and is complete, but sometime later, when new items are watched or added, sync repeatedly fails.

If I try to force sync inside Infuse via Settings>Library>Scan For Changes, it quickly shows "sync failed". The only way to recover it is to run Settings>Clear All Metadata or to remove and re-add the connection, but it will begin failing after library changes occur.

Upon each failure to sync (and other times when Infuse tries to sync automatically) I see exceptions in the logs that look like this:

[2022-09-25 01:25:45.320 -07:00] [ERR] [30] Jellyfin.Server.Middleware.ExceptionMiddleware: Error processing request. URL "GET" "/InfuseSync/Checkpoint/86f1fc094c404b29aab9416e82c7730b/UpdatedItems".
System.NullReferenceException: Object reference not set to an instance of an object.
   at MediaBrowser.Controller.Entities.TV.Season.GetItemsInternal(InternalItemsQuery query)
   at MediaBrowser.Controller.Entities.Folder.FillUserDataDtoValues(UserItemDataDto dto, UserItemData userData, BaseItemDto itemDto, User user, DtoOptions fields)
   at Emby.Server.Implementations.Library.UserDataManager.GetUserDataDto(BaseItem item, BaseItemDto itemDto, User user, DtoOptions options)
   at Emby.Server.Implementations.Dto.DtoService.AttachUserSpecificInfo(BaseItemDto dto, BaseItem item, User user, DtoOptions options)
   at Emby.Server.Implementations.Dto.DtoService.GetBaseItemDtoInternal(BaseItem item, DtoOptions options, User user, BaseItem owner)
   at Emby.Server.Implementations.Dto.DtoService.GetBaseItemDtos(IReadOnlyList`1 items, DtoOptions options, User user, BaseItem owner)
   at InfuseSync.API.InfuseSyncService.Get(GetUpdatedItemsQuery request)
   at InfuseSync.API.InfuseSyncController.GetUpdatedItemsQuery(Guid checkpointID, String includeItemTypes, String fields, Nullable`1 startIndex, Nullable`1 limit)
   at lambda_method2115(Closure , Object , Object[] )
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()
--- End of stack trace from previous location ---
   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__Logged|17_1(ResourceInvoker invoker)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Jellyfin.Server.Middleware.ServerStartupMessageMiddleware.Invoke(HttpContext httpContext, IServerApplicationHost serverApplicationHost, ILocalizationManager localizationManager)
   at Jellyfin.Server.Middleware.WebSocketHandlerMiddleware.Invoke(HttpContext httpContext, IWebSocketManager webSocketManager)
   at Jellyfin.Server.Middleware.IpBasedAccessValidationMiddleware.Invoke(HttpContext httpContext, INetworkManager networkManager)
   at Jellyfin.Server.Middleware.LanFilteringMiddleware.Invoke(HttpContext httpContext, INetworkManager networkManager, IServerConfigurationManager serverConfigurationManager)
   at Microsoft.AspNetCore.Authorization.Policy.AuthorizationMiddlewareResultHandler.HandleAsync(RequestDelegate next, HttpContext context, AuthorizationPolicy policy, PolicyAuthorizationResult authorizeResult)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Jellyfin.Server.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.Server.Middleware.RobotsRedirectionMiddleware.Invoke(HttpContext httpContext)
   at Jellyfin.Server.Middleware.LegacyEmbyRouteRewriteMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.InvokeCore(HttpContext context)
   at Jellyfin.Server.Middleware.ResponseTimeMiddleware.Invoke(HttpContext context, IServerConfigurationManager serverConfigurationManager)
   at Jellyfin.Server.Middleware.ExceptionMiddleware.Invoke(HttpContext context)

I'm currently using: Infuse Pro 7.4.5 4251 (on 64GB Apple TV 4K gen 2, running tvOS 16.0) jellyfin 10.8.4 (on m1 mac mini, running Intel binary via Rosetta under macOS 12.6) InfuseSync 1.4.2.0

It's not a new problem -- it's persisted for the year I've used Jellyfin -- I was hoping when jellyfin 10.8 was released, and the new compatible InfuseSync was released for it that it might fix my problems, but the problem has persisted. I should have reported much earlier, but I always assumed a fix must be right around the corner.

UPDATE 2022-09-28: @anthonylavado Actually, it's not limited to AppleTV -- it happens with Infuse Pro on iPhone and Mac as well, all running latest versions of Infuse and respective OSes. I don't know if I have some uniquely faulty media or metadata, or if this plugin just hasn't worked for (at least) the last year with my combination of operating systems/hardware. I'm not a C# dev, but looking at Season.GetItemsInternal, it looks as though query must have been passed in as null, for some reason. Don't know if it's a InfuseSync bug, or jellyfin issue. There are several closed years-old issues that look to have near identical null pointer exception stack traces involving InfuseSync and Jellyfin, and they seem to have been closed without the confirmation by the initial reporters that things were fixed, so perhaps this is a very old issue. I'm not certain that anyone look at issues in this repo.

anthonylavado commented 2 years ago

I will say - Infuse generally handles support directly. The "Email Us" button in the app will upload diagnostic data, and when you email, a support ticket is created. You can also reach out to them through their forum - https://community.firecore.com.

The only thing I can think of - and please let me know if this is the case - do you have "Display Missing Episodes" enabled in Jellyfin?

To check:


As an anecdotal data point, I have yet to have a problem syncing in the years that I've been using Infuse/InfuseSync/Jellyfin, but I recognize that everyone's setup is different.

SlothCroissant commented 1 year ago

I've also got this issue on Jellyfin 10.8.7 and InfuseSync 1.4.2, same stack trace, same behavior, same everything.

Workaround for now is to fall back to non-InfuseSync slow scans. But hey, it works I guess.

anthonylavado commented 1 year ago

@SlothCroissant I would also encourage you to please get it touch with Firecore, as they would handle support for Infuse and related issues. They can reach out to us too if there's anything going on.

We wouldn't have any access to Infuse's internal logs, so we have no way of knowing exactly what's going on.

firecore commented 5 months ago

I would recommend updating to the latest 10.9 version of Jellyfin and Infuse 7.7.7.

You may also consider using Direct Mode for even faster updates.