ShokoAnime / ShokoServer

Repository for Shoko Server.
https://shokoanime.com/
MIT License
408 stars 74 forks source link

Unable to set manually linked file as watched #746

Closed Baine closed 6 years ago

Baine commented 6 years ago

VERSION INFORMATION

Server Version: 5bd94533dbb8228a830aca9637bded4230bb431f

Desktop Version: fab24ac214522b080b71b49710bdd7f6f0d2f615

LOG FILE

06:40:42| --- ProcessCommand exception: CommandRequest_RefreshAnime_10067
NHibernate.Exceptions.GenericADOException: could not insert: [Shoko.Server.Models.SVR_AnimeEpisode_User][SQL: INSERT INTO AnimeEpisode_User (AnimeEpisodeID, AnimeSeriesID, JMMUserID, PlayedCount, StoppedCount, WatchedCount, WatchedDate, ContractVersion, ContractBlob, ContractSize) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)] ---> MySql.Data.MySqlClient.MySqlException: Duplicate entry '2-4514' for key 'UIX_AnimeEpisode_User_User_EpisodeID'
  at MySql.Data.MySqlClient.MySqlStream.ReadPacket () [0x00096] in <0a135c8e4d604d948724bf6960583b7f>:0
  at MySql.Data.MySqlClient.NativeDriver.GetResult (System.Int32& affectedRow, System.Int64& insertedId) [0x00026] in <0a135c8e4d604d948724bf6960583b7f>:0
  at MySql.Data.MySqlClient.Driver.GetResult (System.Int32 statementId, System.Int32& affectedRows, System.Int64& insertedId) [0x00000] in <0a135c8e4d604d948724bf6960583b7f>:0
  at MySql.Data.MySqlClient.Driver.NextResult (System.Int32 statementId, System.Boolean force) [0x00023] in <0a135c8e4d604d948724bf6960583b7f>:0
  at MySql.Data.MySqlClient.MySqlDataReader.NextResult () [0x00205] in <0a135c8e4d604d948724bf6960583b7f>:0
  at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader (System.Data.CommandBehavior behavior) [0x00315] in <0a135c8e4d604d948724bf6960583b7f>:0
  at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader () [0x00000] in <0a135c8e4d604d948724bf6960583b7f>:0
  at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery () [0x00033] in <0a135c8e4d604d948724bf6960583b7f>:0
  at NHibernate.AdoNet.AbstractBatcher.ExecuteNonQuery (System.Data.IDbCommand cmd) [0x00064] in <1c5d1dfd6b734554b068885679d8b49d>:0
  at NHibernate.Id.Insert.AbstractSelectingDelegate.PerformInsert (NHibernate.SqlCommand.SqlCommandInfo insertSQL, NHibernate.Engine.ISessionImplementor session, NHibernate.Id.Insert.IBinder binder) [0x0002b] in <1c5d1dfd6b734554b068885679d8b49d>:0
   --- End of inner exception stack trace ---
  at NHibernate.Id.Insert.AbstractSelectingDelegate.PerformInsert (NHibernate.SqlCommand.SqlCommandInfo insertSQL, NHibernate.Engine.ISessionImplementor session, NHibernate.Id.Insert.IBinder binder) [0x00071] in <1c5d1dfd6b734554b068885679d8b49d>:0
  at NHibernate.Persister.Entity.AbstractEntityPersister.Insert (System.Object[] fields, System.Boolean[] notNull, NHibernate.SqlCommand.SqlCommandInfo sql, System.Object obj, NHibernate.Engine.ISessionImplementor session) [0x0005b] in <1c5d1dfd6b734554b068885679d8b49d>:0
  at NHibernate.Persister.Entity.AbstractEntityPersister.Insert (System.Object[] fields, System.Object obj, NHibernate.Engine.ISessionImplementor session) [0x0005f] in <1c5d1dfd6b734554b068885679d8b49d>:0
  at NHibernate.Action.EntityIdentityInsertAction.Execute () [0x00047] in <1c5d1dfd6b734554b068885679d8b49d>:0
  at NHibernate.Engine.ActionQueue.Execute (NHibernate.Action.IExecutable executable) [0x00000] in <1c5d1dfd6b734554b068885679d8b49d>:0
  at NHibernate.Event.Default.AbstractSaveEventListener.PerformSaveOrReplicate (System.Object entity, NHibernate.Engine.EntityKey key, NHibernate.Persister.Entity.IEntityPersister persister, System.Boolean useIdentityColumn, System.Object anything, NHibernate.Event.IEventSource source, System.Boolean requiresImmediateIdAccess) [0x00116] in <1c5d1dfd6b734554b068885679d8b49d>:0
  at NHibernate.Event.Default.AbstractSaveEventListener.PerformSave (System.Object entity, System.Object id, NHibernate.Persister.Entity.IEntityPersister persister, System.Boolean useIdentityColumn, System.Object anything, NHibernate.Event.IEventSource source, System.Boolean requiresImmediateIdAccess) [0x000a6] in <1c5d1dfd6b734554b068885679d8b49d>:0
  at NHibernate.Event.Default.AbstractSaveEventListener.SaveWithGeneratedId (System.Object entity, System.String entityName, System.Object anything, NHibernate.Event.IEventSource source, System.Boolean requiresImmediateIdAccess) [0x0004b] in <1c5d1dfd6b734554b068885679d8b49d>:0
  at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.SaveWithGeneratedOrRequestedId (NHibernate.Event.SaveOrUpdateEvent event) [0x0001c] in <1c5d1dfd6b734554b068885679d8b49d>:0
  at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.EntityIsTransient (NHibernate.Event.SaveOrUpdateEvent event) [0x0003d] in <1c5d1dfd6b734554b068885679d8b49d>:0
  at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.PerformSaveOrUpdate (NHibernate.Event.SaveOrUpdateEvent event) [0x00037] in <1c5d1dfd6b734554b068885679d8b49d>:0
  at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.OnSaveOrUpdate (NHibernate.Event.SaveOrUpdateEvent event) [0x00071] in <1c5d1dfd6b734554b068885679d8b49d>:0
  at NHibernate.Impl.SessionImpl.FireSaveOrUpdate (NHibernate.Event.SaveOrUpdateEvent event) [0x00022] in <1c5d1dfd6b734554b068885679d8b49d>:0
  at NHibernate.Impl.SessionImpl.SaveOrUpdate (System.Object obj) [0x00015] in <1c5d1dfd6b734554b068885679d8b49d>:0
  at Shoko.Server.Repositories.BaseCachedRepository`2[T,S].Save (T obj) [0x00062] in /usr/src/app/source/Shoko.Server/Repositories/BaseCachedRepository.cs:244
  at Shoko.Server.Repositories.Cached.AnimeEpisode_UserRepository.Save (Shoko.Server.Models.SVR_AnimeEpisode_User obj) [0x00014] in /usr/src/app/source/Shoko.Server/Repositories/Cached/AnimeEpisode_UserRepository.cs:77
  at Shoko.Server.Models.SVR_AnimeEpisode.GetUserContract (System.Int32 userid, Shoko.Server.Repositories.NHibernate.ISessionWrapper session) [0x000c9] in /usr/src/app/source/Shoko.Server/Models/SVR_AnimeEpisode.cs:159
  at Shoko.Server.PlexAndKodi.Helper+<>c__DisplayClass31_0.<GenerateFromSeries>b__1 (Shoko.Server.Models.SVR_AnimeEpisode a) [0x00000] in /usr/src/app/source/Shoko.Server/PlexAndKodi/Helper.cs:704
  at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement] (System.Collections.Generic.List`1[T] source, System.Func`2[T,TResult] keySelector, System.Func`2[T,TResult] elementSelector, System.Collections.Generic.IEqualityComparer`1[T] comparer) [0x00026] in <521f3fe476f34ea88748e97b3b984d05>:0
  at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] keySelector, System.Func`2[T,TResult] elementSelector, System.Collections.Generic.IEqualityComparer`1[T] comparer) [0x00067] in <521f3fe476f34ea88748e97b3b984d05>:0
  at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] keySelector, System.Func`2[T,TResult] elementSelector) [0x00000] in <521f3fe476f34ea88748e97b3b984d05>:0
  at Shoko.Server.PlexAndKodi.Helper.GenerateFromSeries (Shoko.Models.Client.CL_AnimeSeries_User cserie, Shoko.Server.Models.SVR_AnimeSeries ser, Shoko.Server.Models.SVR_AniDB_Anime anidb, System.Int32 userid, Shoko.Server.Repositories.NHibernate.ISessionWrapper session) [0x0001b] in /usr/src/app/source/Shoko.Server/PlexAndKodi/Helper.cs:703
  at Shoko.Server.Repositories.Cached.AnimeSeries_UserRepository.UpdatePlexKodiContracts (Shoko.Server.Models.SVR_AnimeSeries_User ugrp) [0x00029] in /usr/src/app/source/Shoko.Server/Repositories/Cached/AnimeSeries_UserRepository.cs:95
  at Shoko.Server.Repositories.Cached.AnimeSeries_UserRepository.Save (Shoko.Server.Models.SVR_AnimeSeries_User obj) [0x0000c] in /usr/src/app/source/Shoko.Server/Repositories/Cached/AnimeSeries_UserRepository.cs:68
  at Shoko.Server.Models.SVR_AnimeSeries.UpdateStats (System.Boolean watchedStats, System.Boolean missingEpsStats, System.Boolean updateAllGroupsAbove) [0x00484] in /usr/src/app/source/Shoko.Server/Models/SVR_AnimeSeries.cs:1051
  at Shoko.Server.Models.SVR_AniDB_Anime.UpdateStatsByAnimeID (System.Int32 id) [0x00029] in /usr/src/app/source/Shoko.Server/Models/SVR_AniDB_Anime.cs:1911
  at Shoko.Server.Commands.CommandRequest_RefreshAnime.ProcessCommand () [0x00000] in /usr/src/app/source/Shoko.Server/Commands/CommandRequest_RefreshAnime.cs:38
  at Shoko.Server.Commands.CommandProcessorGeneral.WorkerCommands_DoWork (System.Object sender, System.ComponentModel.DoWorkEventArgs e) [0x00122] in /usr/src/app/source/Shoko.Server/Commands/CommandProcessorGeneral.cs:242
06:40:42| --- Deleting command request: CommandRequest_RefreshAnime_10067

DESCRIPTION

I've got some files (or episodes for that matter), that always show up as unwatched, although they are marked as watched on anidb. I've tried use shoko desktop to mark the file itself as watched (open shoko desktop, open the series, go to episodes, expand episode details, click on the eye icon; "mark all as watched" doesn't work either, but there is no error in log for that) and got the error above. (Could be specific to my db though)

STEPS TO REPRODUCE

Have Manually linked file that is marked as watched on anidb, run "sync mylist"; if file/episode is still marked unwatched, try to mark it as watched manually, get the error above in shoko server console.

Baine commented 6 years ago

local db issue, closed