Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Issue]: database is locked during Subtitle Extraction. #11638

Open
1 task done
gitdeath opened this issue May 14, 2024 · 4 comments
Open
1 task done

[Issue]: database is locked during Subtitle Extraction. #11638

gitdeath opened this issue May 14, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@gitdeath
Copy link

Please describe your bug

Started a subtitle extract.

Reproduction Steps

  1. Local Database Docker 10.9.1
  2. Start Subtitle Extract
  3. Jellyfin GUI spins
  4. Eventually once GUI returns to service logs are full of database is locked

Jellyfin Version

10.9.0

if other:

10.9.1

Environment

- OS/Linux Kernel: Linux nuc1 6.5.0-28-generic #29~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Apr  4 14:39:20 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
- Virtualization: Docker
- Clients: browser, android tv, android phone, ios phone
- Browser: n/a
- FFmpeg Version: jellyfin-ffmpeg6
- Playback Method: n/a
- Hardware Acceleration: QSV
- GPU Model: n/a
- Plugins: AudioDB, MusicBrainz, OMDb, Reports, Studio Images, Subtitle Extract, TMDb (all up to date)
- Reverse Proxy: nginx (swag)
- Base URL: n/a
- Networking: bridge
- Storage: Database Local, Media NFSv3

Jellyfin logs

[2024-05-14 12:15:32.389 -05:00] [INF] [23] MediaBrowser.MediaEncoding.Subtitles.SubtitleEncoder: "/usr/local/bin/ffmpeg" "-i \"/media/movies4k/Movie [imdbid-Movie]/Movie [imdbid-Movie] - [Bluray-2160p][DV HDR10][EAC3 7.1][x265]-HONE.mkv\" -copyts -map 0:2 -an -vn -c:s copy \"/config/data/subtitles/8/86b67f6d-a98b-ad65-49e7-49e9e31c0917.srt\" -map 0:4 -an -vn -c:s copy \"/config/data/subtitles/5/560110e1-4884-e608-fd10-2c5c68f3c3b4.srt\" -map 0:5 -an -vn -c:s copy \"/config/data/subtitles/4/48882577-8d9d-f0ab-c8cd-66a071e703d5.srt\" -map 0:6 -an -vn -c:s copy \"/config/data/subtitles/4/45334c62-b237-1b8d-50c8-cbc419724ed6.srt\" -map 0:7 -an -vn -c:s copy \"/config/data/subtitles/3/301ec48d-207b-cbb0-de65-b7f92c7219f3.srt\" -map 0:9 -an -vn -c:s copy \"/config/data/subtitles/a/ad376519-e6b5-d0d4-eab4-30f7eb6f4da2.srt\" -map 0:12 -an -vn -c:s copy \"/config/data/subtitles/5/5c3d74cd-a267-31c5-39ad-f21b456818b6.srt\" -map 0:13 -an -vn -c:s copy \"/config/data/subtitles/d/d0b3c7ae-fa59-e402-f8ba-1c23e05c1502.srt\" -map 0:14 -an -vn -c:s copy \"/config/data/subtitles/e/e8ed182c-c7a9-9dc0-1ef7-0adb63ac28d7.srt\" -map 0:15 -an -vn -c:s copy \"/config/data/subtitles/5/5fdb3ae0-84a1-2c88-4641-75d2fcfc83c8.srt\" -map 0:16 -an -vn -c:s copy \"/config/data/subtitles/4/42b7a089-4d79-9159-a01c-a168387a4fb9.srt\" -map 0:17 -an -vn -c:s copy \"/config/data/subtitles/5/5ebaa1c5-24b5-446f-fd2e-bb15fbf37fe0.srt\" -map 0:18 -an -vn -c:s copy \"/config/data/subtitles/8/84c1f1ea-14f3-7b0f-baed-b6b5e999d8ac.srt\" -map 0:19 -an -vn -c:s copy \"/config/data/subtitles/8/864691dc-0a67-8199-afb1-9fd0a9476f7b.srt\" -map 0:20 -an -vn -c:s copy \"/config/data/subtitles/6/6da37989-b438-7645-593f-ad89a9bbb56c.srt\" -map 0:21 -an -vn -c:s copy \"/config/data/subtitles/9/9964b5e9-08e2-896f-2d64-921fd665f791.srt\" -map 0:23 -an -vn -c:s copy \"/config/data/subtitles/b/b92979df-ec12-09f3-cdb4-0801859317c3.srt\" -map 0:24 -an -vn -c:s copy \"/config/data/subtitles/6/6dfd514b-7d8f-31c7-8f2c-274a8b9ae031.srt\" -map 0:25 -an -vn -c:s copy \"/config/data/subtitles/6/6f90028d-e71f-c72f-a0b0-088a8cbfd88d.srt\" -map 0:26 -an -vn -c:s copy \"/config/data/subtitles/0/0192cba8-ec40-7e7d-fd86-37910712b605.srt\" -map 0:27 -an -vn -c:s copy \"/config/data/subtitles/3/3f91d0e2-efc5-7e12-0b42-df38d6b0b590.srt\" -map 0:28 -an -vn -c:s copy \"/config/data/subtitles/9/9b2f5c34-2edb-5132-bf53-84d1b2a97ae7.srt\" -map 0:29 -an -vn -c:s copy \"/config/data/subtitles/5/5f5afa9b-d742-9751-1b31-b25ce5a4433f.srt\" -map 0:32 -an -vn -c:s copy \"/config/data/subtitles/5/519163e5-4a1a-250c-6acf-74d06d1b8498.srt\" -map 0:33 -an -vn -c:s copy \"/config/data/subtitles/7/7d6f3788-2ee2-3322-b5be-fcb66969ce4a.srt\""
[2024-05-14 12:17:15.115 -05:00] [INF] [41] Emby.Server.Implementations.HttpServer.WebSocketManager: WS "192.168.1.127" request
[2024-05-14 12:17:33.750 -05:00] [INF] [121] Emby.Server.Implementations.Session.SessionWebSocketListener: Sending ForceKeepAlive message to 1 inactive WebSockets.
[2024-05-14 12:18:04.458 -05:00] [ERR] [23] Microsoft.EntityFrameworkCore.Database.Command: Failed executing DbCommand ("30,156"ms) [Parameters=["@p10='?' (DbType = Int32), @p0='?' (Size = 32), @p1='?' (Size = 12), @p2='?' (Size = 6), @p3='?' (DbType = DateTime), @p4='?' (DbType = DateTime), @p5='?' (DbType = DateTime), @p6='?' (Size = 168), @p7='?' (Size = 6), @p8='?' (DbType = Boolean), @p9='?' (DbType = Guid)"], CommandType='Text', CommandTimeout='30']"
""UPDATE \"Devices\" SET \"AccessToken\" = @p0, \"AppName\" = @p1, \"AppVersion\" = @p2, \"DateCreated\" = @p3, \"DateLastActivity\" = @p4, \"DateModified\" = @p5, \"DeviceId\" = @p6, \"DeviceName\" = @p7, \"IsActive\" = @p8, \"UserId\" = @p9
WHERE \"Id\" = @p10
RETURNING 1;"
[2024-05-14 12:18:04.465 -05:00] [ERR] [23] Microsoft.EntityFrameworkCore.Update: An exception occurred in the database while saving changes for context type '"Jellyfin.Server.Implementations.JellyfinDbContext"'."
""Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while saving the entity changes. See the inner exception for details.
 ---> Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 5: 'database is locked'.
   at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(IList`1 entriesToSave, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(StateManager stateManager, Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)"
Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while saving the entity changes. See the inner exception for details.
 ---> Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 5: 'database is locked'.
   at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(IList`1 entriesToSave, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(StateManager stateManager, Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, 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)
   at Emby.Server.Implementations.HttpServer.Security.AuthService.Authenticate(HttpRequest request)
   at Jellyfin.Api.Auth.CustomAuthenticationHandler.HandleAuthenticateAsync()
   at Microsoft.AspNetCore.Authentication.AuthenticationHandler`1.AuthenticateAsync()
   at Microsoft.AspNetCore.Authentication.AuthenticationService.AuthenticateAsync(HttpContext context, String scheme)

FFmpeg logs

No response

Please attach any browser or client logs here

No response

Please attach any screenshots here

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@gitdeath gitdeath added the bug Something isn't working label May 14, 2024
@jellyfin-bot
Copy link
Contributor

Hi, it seems like your issue report has the following item(s) that need to be addressed:

  • The format of the environment section has been altered from the template.

This is an automated message, currently under testing. Please file an issue here if you encounter any problems.

@gitdeath
Copy link
Author

The Database is locked issue appears to just repeat over and over with the below being the last one.

[2024-05-14 12:19:37.031 -05:00] [ERR] [73] Jellyfin.Api.Middleware.ExceptionMiddleware: Error processing request. URL "GET" "/System/ActivityLog/Entries".
Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while saving the entity changes. See the inner exception for details.
 ---> Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 5: 'database is locked'.
   at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(IList`1 entriesToSave, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(StateManager stateManager, Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, 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)
   at Emby.Server.Implementations.HttpServer.Security.AuthService.Authenticate(HttpRequest request)
   at Jellyfin.Api.Auth.CustomAuthenticationHandler.HandleAuthenticateAsync()
   at Microsoft.AspNetCore.Authentication.AuthenticationHandler`1.AuthenticateAsync()
   at Microsoft.AspNetCore.Authentication.AuthenticationService.AuthenticateAsync(HttpContext context, String scheme)
   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)

@Simsala91
Copy link

Simsala91 commented May 14, 2024

There have been several issues regarding database locks, try to set Parallel library scan tasks limit and Parallel image encoding limit to 1 in Admin-Dashboard/General and see if the issue still exists.

Probably duplicate of #11624

@hardwareadictos
Copy link

hardwareadictos commented May 17, 2024

The Database is locked issue appears to just repeat over and over with the below being the last one.

As stated here: #11589 this does not fix the lock ups, for now under my experience the best we can do is to stick on 10.8.13 for now and wait for 10.9.2 to fix the DB locking issues, which are appearing on multiple situations, like on scanning libraries, loading metadata images and on this case with subtitle extraction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: No status
Development

No branches or pull requests

4 participants