• Login
  • Register
  • Login Register
    Login
    Username/Email:
    Password:
    Or login with a social network below
  • Forum
  • Website
  • GitHub
  • Status
  • Translation
  • Features
  • Team
  • Rules
  • Help
  • Feeds
User Links
  • Login
  • Register
  • Login Register
    Login
    Username/Email:
    Password:
    Or login with a social network below

    Useful Links Forum Website GitHub Status Translation Features Team Rules Help Feeds
    Jellyfin Forum Support Troubleshooting SQLite Error: database is locked

     
    • 0 Vote(s) - 0 Average

    SQLite Error: database is locked

    ---> Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 5: 'database is locked'.
    happyvoid
    Offline

    Junior Member

    Posts: 24
    Threads: 8
    Joined: 2023 Jun
    Reputation: 0
    #1
    2024-06-11, 04:52 AM (This post was last modified: 2024-06-14, 11:15 AM by Venson. Edited 2 times in total.)
    After using SynoCommunity packager for a few years with 10.8 running ok, after runnnig into issues with 10.9 switched to Docker setup on a Synology 218+.

    This is a new setup using the following docker_compose.yml file:

    Code:
    services:
      jellyfin:
        container_name: jellyfin
        image: jellyfin/jellyfin
        ports:
          - "8096:8096"
        environment:
          - PUID=UID_GOES_HERE (this is the actual UID)
          - PGID=100
          - UMASK=002
          - TZ=Europe/Berlin
        volumes:
          - /volume1/docker/jellyfin:/config
          - /volume1/Share1:/Share1:ro
          - /volume1/Share2:/Share2ro
          - /volume1/Share3:/Share3:ro
        devices:
          - /dev/dri:/dev/dri

    Added folders from the three different shares to Library. Let Jellyfin sit, scan and do it's thing for a few days.

    It seems scans and Audio Normalisation have finished. But whenever trying to access Jellyfin there is a lot of audible accessing going on on the NAS to the point where everything seems to lockup (two hhds on a 218+, no NVMe). Clicking menu items e.g. like Scheduled Tasks just shows the spinner and no info ever loads. Same is true trying to access home. Sometimes the items load, but it is slow to a point where the library is not usable.

    Looking at the logs, database is locked does not sound great:

    Code:
    [2024-06-11 06:23:54.110 +02:00] [ERR] [279] Jellyfin.Api.Middleware.ExceptionMiddleware: Error processing request. URL "POST" "/Users/AuthenticateByName".
    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.SqliteConnectionExtensions.ExecuteNonQuery(SqliteConnection connection, String commandText, SqliteParameter[] parameters)
      at Microsoft.Data.Sqlite.SqliteTransaction..ctor(SqliteConnection connection, IsolationLevel isolationLevel, Boolean deferred)
      at System.Data.Common.DbConnection.BeginDbTransactionAsync(IsolationLevel isolationLevel, CancellationToken cancellationToken)
    --- End of stack trace from previous location ---

    More log: https://bin.disroot.org/?ce008bc32593b7a...SeDgtnf98N (1 month)

    Was unsure about
    Code:
    [2024-06-11 06:13:45.194 +02:00] [INF] [257] Jellyfin.Api.Auth.CustomAuthenticationHandler: "CustomAuthentication" was not authenticated. Failure message: "Invalid token."
    so tried logging out the old login on some devices and setting up the server and user again.

    Any idea what I am doing wrong or why the NAS chokes up? I know this isn't an ideal setup performance wise. But in the past this worked on acceptable level using v10.8 and the SynoCommunity package.
    Go to solution
    crobibero
    Offline

    Core Team (Server & Plugins)

    Posts: 243
    Threads: 0
    Joined: 2023 Jun
    Reputation: 17
    Country:United States
    #2
    2024-06-11, 09:34 AM
    Please upgrade to 10.9.6. If you are already on 10.9.6 we would need a full log, not just the exception.
    happyvoid
    Offline

    Junior Member

    Posts: 24
    Threads: 8
    Joined: 2023 Jun
    Reputation: 0
    #3
    2024-06-11, 11:37 AM
    Thanks for taking a look. This is 10.9.6.

    Full log: https://bin.disroot.org/?4db311bd04dfb92...6B7DQKr3VG

    There's some logging in going on as I migrated client apps to the new server on a few devices.
    pcm
    Offline

    Member

    Posts: 62
    Threads: 4
    Joined: 2024 May
    Reputation: 0
    Country:Uzbekistan
    #4
    2024-06-11, 06:21 PM (This post was last modified: 2024-06-11, 06:31 PM by pcm. Edited 11 times in total.)
    I kept having this *exactly same* issue too. I had (have) this issue on 1.9.2 and 1.9.3 (my current) and I had to change "Parallel library scan tasks limit" to 1 (it's 0 by default, which will set the number of scans to number of cpu-threads your computer can run).
    And that fixed the issue for me because now there is only one thread doing the library scan and writing to library.db file and hence no way to do get into a race condition/deadlock ... Not the most performant solution but got the job done for me. Be aware that your scans will take a lot longer but they'll complete guaranteed.
    You can find 'Parallel library scan tasks limit' config setting under "general" section in your admin-dashboard.
    1
    happyvoid
    Offline

    Junior Member

    Posts: 24
    Threads: 8
    Joined: 2023 Jun
    Reputation: 0
    #5
    2024-06-14, 10:30 AM (This post was last modified: 2024-06-14, 10:41 AM by happyvoid. Edited 1 time in total.)
    Thanks for sharing your suggestion to change Parallel library scan tasks limit to 1. I tried that, while it may have helped, it did not resolve the overall slowness I was encountering.

    What did help was setting an environment variable for the docker container:

    1. stopped the docker project
    2. in the environment: section of the docker-compose-yml file I added the line - JELLYFIN_SQLITE__disableSecondLevelCache=true
    3. re-build docker project

    This did help and Jellyfin was in usable state for a while.

    Currently though I am again seeing the problematic errors in the log, so I was wrong thinking this was no longer a problem and sadly both the change for scan tasks and the env var did not resolve the issue:


    [2024-06-14 10:34:07.742 +02:00] [ERR] [96] 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(IEnumerable1 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(IList1 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)"
    gnattu
    Offline

    Team Member

    Posts: 336
    Threads: 0
    Joined: 2024 Feb
    Reputation: 17
    #6
    2024-06-14, 04:00 PM
    More likely you will need https://github.com/jellyfin/jellyfin/pull/11901 merged for your issue as 2nd level cache works badly for your setup and need a device cache to be implemented separately.
    1
    1
    « Next Oldest | Next Newest »

    Users browsing this thread: 1 Guest(s)


    • View a Printable Version
    • Subscribe to this thread
    Forum Jump:

    Home · Team · Help · Contact
    © Designed by D&D - Powered by MyBB
    L


    Jellyfin

    The Free Software Media System

    Linear Mode
    Threaded Mode