ShokoAnime / ShokoServer

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

constraint failed UNIQUE constraint failed: AniDB_File.FileID at System.Data.SQLite.SQLite3.Reset #860

Closed karel-de-macil closed 3 years ago

karel-de-macil commented 3 years ago

## PLEASE READ BEFORE POSTING YOUR ISSUE

Please create GitHub issues only for bugs and feature requests. If you need help with using Shoko or have a question, join us on Discord.

https://discord.gg/vpeHDsg

===== Guidelines ====

VERSION INFORMATION

Server Version:

Desktop Version:

If you've compiled your own version, please use the last commit you compiled.

LOG FILE

ATTACH YOUR LOGS HERE

Error processing CommandRequest_ProcessFile: 1399 - NHibernate.Exceptions.GenericADOException: could not insert: [Shoko.Server.Models.SVR_AniDB_File][SQL: INSERT INTO AniDB_File (Anime_GroupName, Anime_GroupNameShort, AnimeID, CRC, DateTimeUpdated, Episode_Rating, Episode_Votes, File_AudioCodec, File_Description, File_FileExtension, File_LengthSeconds, File_ReleaseDate, File_Source, File_VideoCodec, File_VideoResolution, FileID, FileName, FileSize, FileVersion, IsCensored, IsDeprecated, IsChaptered, InternalVersion, GroupID, Hash, IsWatched, MD5, SHA1, WatchedDate) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?); select last_insert_rowid()] ---> code = Constraint (19), message = System.Data.SQLite.SQLiteException (0x800027AF): constraint failed UNIQUE constraint failed: AniDB_File.FileID at System.Data.SQLite.SQLite3.Reset(SQLiteStatement stmt) at System.Data.SQLite.SQLite3.Step(SQLiteStatement stmt) at System.Data.SQLite.SQLiteDataReader.NextResult() at System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, CommandBehavior behave) at System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior) at NHibernate.AdoNet.AbstractBatcher.ExecuteReader(IDbCommand cmd) at NHibernate.Id.IdentityGenerator.InsertSelectDelegate.ExecuteAndExtract(IDbCommand insert, ISessionImplementor session) at NHibernate.Id.Insert.AbstractReturningDelegate.PerformInsert(SqlCommandInfo insertSQL, ISessionImplementor session, IBinder binder) --- End of inner exception stack trace --- at NHibernate.Id.Insert.AbstractReturningDelegate.PerformInsert(SqlCommandInfo insertSQL, ISessionImplementor session, IBinder binder) at NHibernate.Persister.Entity.AbstractEntityPersister.Insert(Object[] fields, Object obj, ISessionImplementor session) at NHibernate.Action.EntityIdentityInsertAction.Execute() at NHibernate.Engine.ActionQueue.Execute(IExecutable executable) at NHibernate.Event.Default.AbstractSaveEventListener.PerformSaveOrReplicate(Object entity, EntityKey key, IEntityPersister persister, Boolean useIdentityColumn, Object anything, IEventSource source, Boolean requiresImmediateIdAccess) at NHibernate.Event.Default.AbstractSaveEventListener.SaveWithGeneratedId(Object entity, String entityName, Object anything, IEventSource source, Boolean requiresImmediateIdAccess) at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.EntityIsTransient(SaveOrUpdateEvent event) at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.OnSaveOrUpdate(SaveOrUpdateEvent event) at NHibernate.Impl.SessionImpl.FireSaveOrUpdate(SaveOrUpdateEvent event) at NHibernate.Impl.SessionImpl.SaveOrUpdate(Object obj) at Shoko.Server.Repositories.BaseCachedRepository2.Save(T obj) in /usr/src/app/source/Shoko.Server/Repositories/BaseCachedRepository.cs:line 262 at Shoko.Server.Repositories.AniDB_FileRepository.Save(SVR_AniDB_File obj, Boolean updateStats) in /usr/src/app/source/Shoko.Server/Repositories/Cached/AniDB_FileRepository.cs:line 49 at Shoko.Server.Commands.CommandRequest_ProcessFile.TryGetAniDBFileFromAniDB(SVR_VideoLocal vidLocal, Dictionary2 animeIDs) at Shoko.Server.Commands.CommandRequest_ProcessFile.ProcessFile_AniDB(SVR_VideoLocal vidLocal) in /usr/src/app/source/Shoko.Server/Commands/Import/CommandRequest_ProcessFile.cs:line 110 at Shoko.Server.Commands.CommandRequest_ProcessFile.ProcessCommand() in /usr/src/app/source/Shoko.Server/Commands/Import/CommandRequest_ProcessFile.cs:line 85

DESCRIPTION

Under shoko server docker version when importing my collection i have a few of message like the following

related event

will gladly send my shoko db and gladly receve advice on how to clean it to make it fully work again. best regards

ready to answer to any question

Describe the problem you've encountered. What caused the issue, and what you expected to happen. Screenshot’s, Videos and any additional information is welcomed and will help us fix the problem.

STEPS TO REPRODUCE

import my collection ... (and maybe being ban during the import process)/: more precisely use another anidb client on the same collection , partially use import on a collection in shoko where some item have allready being ask to anydb the same day be ban for this... pause the import process after getting a few error 500/ban message in the log.

launch it again when you are no longer ban ... badam you get it...

Being as detailed as possible, please list all steps need to reproduce the issue, if we can't reproduce it then we can't fix it.

Metzlmane commented 3 years ago

Same here, with same steps to reproduce.

Docker: Shoko Server Version: v4.0.1.0

da3dsoul commented 3 years ago

This is fixed. We forgot to close this. Grab a daily by appending :daily to the image tag and pulling