Jump to content

Unable to scan new items: Busy: database is locked


katbyte
Go to solution Solved by katbyte,

Recommended Posts

katbyte

Hello,

I run emby in a docker container on linux with volumes mounted on CIFS shares. This has worked great for years now but I recently reinstalled my os as i was moving to a new server and now, without changing anything, i am unable to scan new items and am getting the Busy" database is locked error. The server works as normal otherwise. users and media is all there. plays things just fine. I can even create a new user.

Quote

2022-07-08 07:12:50.528 Error SqliteItemRepository: Error saving items
    *** Error Report ***
    Version: 4.8.0.3
    Command line: /system/EmbyServer.dll -programdata /config -ffdetect /bin/ffdetect -ffmpeg /bin/ffmpeg -ffprobe /bin/ffprobe -restartexitcode 3
    Operating system: Linux version 5.10.0-15-amd64 (debian-kernel@lists.debian.org) (gcc-10 (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2) #1
    Framework: .NET 6.0.2
    OS/Process: x64/x64
    Runtime: system/System.Private.CoreLib.dll
    Processor count: 12
    Data path: /config
    Application path: /system
    SQLitePCL.pretty.SQLiteException: Busy: database is locked
    SQLitePCL.pretty.SQLiteException: Exception of type 'SQLitePCL.pretty.SQLiteException' was thrown.
       at SQLitePCL.pretty.SQLiteException.CheckOk(sqlite3 db, Int32 rc)
       at SQLitePCL.pretty.StatementImpl.MoveNext()
       at Emby.Server.Implementations.Data.SqliteItemRepository.GetUserDataKeyId(String userDataKey, IStatement insertUserDataKeyStatement, IStatement getUserDataKeyStatement)
       at Emby.Server.Implementations.Data.SqliteItemRepository.SaveItemsInTranscation(IDatabaseConnection db, List`1 tuples, MetadataRefreshOptions metadataRefreshOptions)
       at Emby.Server.Implementations.Data.SqliteItemRepository.SaveItems(List`1 items, MetadataRefreshOptions metadataRefreshOptions, Action`1 afterSave, CancellationToken cancellationToken)
    Source: SQLitePCL.pretty
    TargetSite: Void CheckOk(SQLitePCLEx.sqlite3, Int32)

2022-07-08 07:12:50.529 Error ProviderManager: Error refreshing item
    *** Error Report ***
    Version: 4.8.0.3
    Command line: /system/EmbyServer.dll -programdata /config -ffdetect /bin/ffdetect -ffmpeg /bin/ffmpeg -ffprobe /bin/ffprobe -restartexitcode 3
    Operating system: Linux version 5.10.0-15-amd64 (debian-kernel@lists.debian.org) (gcc-10 (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2) #1
    Framework: .NET 6.0.2
    OS/Process: x64/x64
    Runtime: system/System.Private.CoreLib.dll
    Processor count: 12
    Data path: /config
    Application path: /system
    SQLitePCL.pretty.SQLiteException: Busy: database is locked
    SQLitePCL.pretty.SQLiteException: Exception of type 'SQLitePCL.pretty.SQLiteException' was thrown.
       at SQLitePCL.pretty.SQLiteException.CheckOk(sqlite3 db, Int32 rc)
       at SQLitePCL.pretty.StatementImpl.MoveNext()
       at Emby.Server.Implementations.Data.SqliteItemRepository.GetUserDataKeyId(String userDataKey, IStatement insertUserDataKeyStatement, IStatement getUserDataKeyStatement)
       at Emby.Server.Implementations.Data.SqliteItemRepository.SaveItemsInTranscation(IDatabaseConnection db, List`1 tuples, MetadataRefreshOptions metadataRefreshOptions)
       at Emby.Server.Implementations.Data.SqliteItemRepository.SaveItems(List`1 items, MetadataRefreshOptions metadataRefreshOptions, Action`1 afterSave, CancellationToken cancellationToken)
       at Emby.Server.Implementations.Data.SqliteItemRepository.SaveItems(List`1 items, MetadataRefreshOptions metadataRefreshOptions, CancellationToken cancellationToken)
       at Emby.Server.Implementations.Library.LibraryManager.CreateItems(List`1 items, BaseItem parent, MetadataRefreshOptions metadataRefreshOptions, CancellationToken cancellationToken)
       at MediaBrowser.Controller.Entities.Folder.ValidateChildrenInternal(IProgress`1 progress, CancellationToken cancellationToken, Boolean recursive, Boolean refreshChildMetadata, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService)
       at MediaBrowser.Controller.Entities.Folder.ValidateSubFolders(BaseItem[] children, IDirectoryService directoryService, IProgress`1 progress, CancellationToken cancellationToken)
       at MediaBrowser.Controller.Entities.Folder.ValidateChildrenInternal(IProgress`1 progress, CancellationToken cancellationToken, Boolean recursive, Boolean refreshChildMetadata, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService)
       at Emby.Providers.Manager.ProviderManager.RefreshItem(BaseItem item, MetadataRefreshOptions options, CancellationToken cancellationToken)
       at Emby.Providers.Manager.ProviderManager.StartProcessingRefreshQueue()
    Source: SQLitePCL.pretty
    TargetSite: Void CheckOk(SQLitePCLEx.sqlite3, Int32)
 

the linux version is the same. the only thing that changed was the emby server user was 1001 and now it's 1000 (and i have updated docker config)

I have followed the steps in https://support.emby.media/support/solutions/articles/44002210894-corrupt-databas, even deleting all wal and shm files. the database integrity check for library is fine.

image.thumb.png.c1095398711704cc614fe55bca42d898.png

weirdly enough if i run the integrity check while emby is running its locked, stop emby and its no longer locked.

i checked all other databases and they seem fine to:

image.thumb.png.feb4c4ce753984d215c962a2183f35ab.png

Any ideas of what could be causing this? or things to look at next? 

thanks

edit: i tried the recovery steps in that link and got this:

image.thumb.png.1bd3786d113346672bc70a419cc289ae.png

but then when i copied off the network share the command ran without issue.. however when i copied that back into the data dir the server wouldn't even start up

Quote

[00:51:04] root@docker:/mnt/data/docker/media/emby/data# tail -f /mnt/data/docker/media/emby/logs/embyserver-63792862105.txt
       at Emby.Server.Implementations.Library.UserDataManager.SaveUserData(User user, BaseItem item, UserItemData userData, UserDataSaveReason reason, CancellationToken cancellationToken)
       at Emby.Server.Implementations.Session.SessionManager.OnPlaybackProgress(User user, BaseItem item, PlaybackProgressInfo info, SessionInfo sessionInfo)
       at Emby.Server.Implementations.Session.SessionManager.OnPlaybackProgress(PlaybackProgressInfo info, Boolean isAutomated)
       at Emby.Server.Implementations.Services.ServiceController.GetTaskResult(Task task)
       at Emby.Server.Implementations.Services.ServiceHandler.ProcessRequestAsync(HttpListenerHost appHost, IRequest httpReq, IResponse httpRes, RestPath restPath, String responseContentType, CancellationToken cancellationToken)
       at Emby.Server.Implementations.HttpServer.HttpListenerHost.RequestHandler(IRequest httpReq, ReadOnlyMemory`1 urlString, ReadOnlyMemory`1 localPath, CancellationToken cancellationToken)
    Source: SQLitePCL.pretty
    TargetSite: Void CheckOk(SQLitePCLEx.sqlite3, Int32)

2022-07-08 07:21:15.079 Info Server: http/1.1 Response 500 to ‌‍‍‍142.179.112.66‌. Time: 8ms. http://‌‍‍‍m.katbyte.me‌/emby/Sessions/Playing/Progress?X-Emby-Client=Emby Web&X-Emby-Device-Name=Google Chrome Windows&X-Emby-Device-Id=7cac6f3d-2b8e-4130-9b8d-634fd9de5352&X-Emby-Client-Version=4.8.0.3&reqformat=json

copied the original library.db in and it goes back to database being locked

 

Edited by katbyte
Link to comment
Share on other sites

  • Solution
katbyte

solved! looks like nolock was missing from the cifs mount options. popped that in and all is well now :)

  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...