Ombi-app / Ombi

Want a Movie or TV Show on Plex/Emby/Jellyfin? Use Ombi!
http://ombi.io
GNU General Public License v2.0
3.69k stars 396 forks source link

SQLite Error 5: 'database is locked'. #2750

Closed xp-1000 closed 5 years ago

xp-1000 commented 5 years ago

Describe the bug Hello, I just tried to upgrade from 3.0.4036 to v3.0.4119 and I go this error when I started the new version. It seems similar to 2375 issue.

To Reproduce I tried on a fresh install and the upgrade works, the database is not locked so I am afraid it will be difficult to reproduce.

Expected behavior Ombi start and and can read database

Screenshots not relevant here

Logs (Logs directory where Ombi is located)

janv. 21 22:58:08 domain.tld Ombi[58316]: Application startup exception: Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 5: 'database is locked'.
janv. 21 22:58:08 domain.tld Ombi[58316]:    at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
janv. 21 22:58:08 domain.tld Ombi[58316]:    at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
janv. 21 22:58:08 domain.tld Ombi[58316]:    at Microsoft.Data.Sqlite.SqliteCommand.ExecuteNonQuery()
janv. 21 22:58:08 domain.tld Ombi[58316]:    at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.Execute(IRelationalConnection connection, DbCommandMethod executeMethod, IReadOnlyDictionary`2 parameterValues)
janv. 21 22:58:08 domain.tld Ombi[58316]:    at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.ExecuteNonQuery(IRelationalConnection connection, IReadOnlyDictionary`2 parameterValues)
janv. 21 22:58:08 domain.tld Ombi[58316]:    at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.ExecuteSqlCommand(DatabaseFacade databaseFacade, RawSqlString sql, IEnumerable`1 parameters)
janv. 21 22:58:08 domain.tld Ombi[58316]:    at Ombi.Store.Context.OmbiContext.Seed() in C:\projects\requestplex\src\Ombi.Store\Context\OmbiContext.cs:line 91
janv. 21 22:58:08 domain.tld Ombi[58316]:    at Ombi.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IMemoryCache cache, IServiceProvider serviceProvider) in C:\projects\requestplex\src\Ombi\Startup.cs:line 221
janv. 21 22:58:08 domain.tld Ombi[58316]: --- End of stack trace from previous location where exception was thrown ---
janv. 21 22:58:08 domain.tld Ombi[58316]:    at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app)
janv. 21 22:58:08 domain.tld Ombi[58316]:    at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
janv. 21 22:58:08 domain.tld Ombi[58316]: Unhandled Exception: Microsoft.Data.Sqlite.SqliteException: SQLite Error 5: 'database is locked'.
janv. 21 22:58:08 domain.tld Ombi[58316]:    at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
janv. 21 22:58:08 domain.tld Ombi[58316]:    at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
janv. 21 22:58:08 domain.tld Ombi[58316]:    at Microsoft.Data.Sqlite.SqliteCommand.ExecuteNonQuery()
janv. 21 22:58:08 domain.tld Ombi[58316]:    at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.Execute(IRelationalConnection connection, DbCommandMethod executeMethod, IReadOnlyDictionary`2 parameterValues)
janv. 21 22:58:08 domain.tld Ombi[58316]:    at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.ExecuteNonQuery(IRelationalConnection connection, IReadOnlyDictionary`2 parameterValues)
janv. 21 22:58:08 domain.tld Ombi[58316]:    at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.ExecuteSqlCommand(DatabaseFacade databaseFacade, RawSqlString sql, IEnumerable`1 parameters)
janv. 21 22:58:08 domain.tld Ombi[58316]:    at Ombi.Store.Context.OmbiContext.Seed() in C:\projects\requestplex\src\Ombi.Store\Context\OmbiContext.cs:line 91
janv. 21 22:58:08 domain.tld Ombi[58316]:    at Ombi.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IMemoryCache cache, IServiceProvider serviceProvider) in C:\projects\requestplex\src\Ombi\Startup.cs:line 221
janv. 21 22:58:08 domain.tld Ombi[58316]: --- End of stack trace from previous location where exception was thrown ---
janv. 21 22:58:08 domain.tld Ombi[58316]:    at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app)
janv. 21 22:58:08 domain.tld Ombi[58316]:    at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
janv. 21 22:58:08 domain.tld Ombi[58316]:    at Microsoft.AspNetCore.Hosting.Internal.WebHost.StartAsync(CancellationToken cancellationToken)
janv. 21 22:58:08 domain.tld Ombi[58316]:    at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token, String shutdownMessage)
janv. 21 22:58:08 domain.tld Ombi[58316]:    at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token)
janv. 21 22:58:08 domain.tld Ombi[58316]:    at Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(IWebHost host)
janv. 21 22:58:08 domain.tld Ombi[58316]:    at Ombi.Program.Main(String[] args) in C:\projects\requestplex\src\Ombi\Program.cs:line 99
janv. 21 22:58:09 domain.tld systemd[1]: ombi.service: Main process exited, code=dumped, status=6/ABRT

Desktop (please complete the following information):

Ombi Version (please complete the following information):

Additional context Honnestly, I suspect the problem was present BEFORE the upgrade because I cannot connect with my account so it could not be related to the upgrade itself but rahter than a previous crash. I understand I don't provide enough information to do a real debug and I am sorry for that but I cannot give you more. I don't expect you fix an obscure bug in this situation but if you have a workaround to manually unlock the database file I could do more tests. When I stop ombi I can read the database from command line so the file itself seems not corrupted. Sadly, Ombi restarts in loop with the same database locked error.


sqlite3 Ombi.db 
SQLite version 3.26.0 2018-12-01 12:34:55
Enter ".help" for usage hints.
sqlite> .tables
AlbumRequests                NotificationTemplates      
ApplicationConfiguration     NotificationUserId         
AspNetRoleClaims             PlexEpisode                
AspNetRoles                  PlexSeasonsContent         
AspNetUserClaims             PlexServerContent          
AspNetUserLogins             RadarrCache                
AspNetUserRoles              RecentlyAddedLog           
AspNetUserTokens             RequestLog                 
AspNetUsers                  RequestQueue               
Audit                        RequestSubscription        
ChildRequests                SeasonRequests             
CouchPotatoCache             SickRageCache              
EmbyContent                  SickRageEpisodeCache       
EmbyEpisode                  SonarrCache                
EpisodeRequests              SonarrEpisodeCache         
GlobalSettings               Tokens                     
IssueCategory                TvIssues                   
IssueComments                TvRequests                 
Issues                       UserNotificationPreferences
LidarrAlbumCache             UserQualityProfiles        
LidarrArtistCache            Votes                      
MovieIssues                  __EFMigrationsHistory      
MovieRequests    
5drH64gDnDJb commented 5 years ago

@tidusjar, everything is working great so far, only issue I see is that when I add a new tv show > select All Seasons, in sonarr its added but it doesn't select any of the seasons. Just thought I would give u heads up, would you like me to try the latest dev release, and would you like me to create a new issue for the All Seasons problem? Thanks for all the help

tidusjar commented 5 years ago

Ok excellent. What version is that on?

5drH64gDnDJb commented 5 years ago

Ok excellent. What version is that on?

Version 3.0.4346

xp-1000 commented 5 years ago

Hello,

I tested 3.0.4348 version and I still have database lock errors in both cases I described : https://github.com/tidusjar/Ombi/issues/2750#issuecomment-475828716

But I did not find other problems, ombi works for request and issues as far as I tested. Thanks

tidusjar commented 5 years ago

I think I have realised what the issue is finally.

Please delete your Schedules.db and restart ombi. It will work fine then

5drH64gDnDJb commented 5 years ago

I think I have realised what the issue is finally.

Please delete your Schedules.db and restart ombi. It will work fine then

Done, deleted Schedules.db and updated to your latest dev version, thanks!

tidusjar commented 5 years ago

I've just pushed another update that deletes the schedules.db on start, I am not 99.99% sure it's the SQLite library I am using with the internal scheduler. Deleting the schedules.db will 100% fix this issue, since it seems to be trying to queue up many jobs on start locking up the entire db.

I am closing this as a resolution (FINALLY!).

Please let me know if this is not the case for you.

Thank everyone for their patience and help with this.

gamechld commented 5 years ago

Will there be any ramifications for us from deleting schedules.db?

Funny thing is I was 4 days into testing 4340 and it didn't lock up for me, but that's not a guarantee, especially since it seems others did get a lockup. I have now swapped over to 4350.

tidusjar commented 5 years ago

There are none, it's a db for keeping track of the schedule jobs.

xp-1000 commented 5 years ago

Hello @tidusjar I stopped ombi, upgraded to 3.0.4350, removed schedules.db then restarted ombi and I still have lock problem on notifications configuration (submit button) and user details configuration.

xp-1000 commented 5 years ago

Hmm my bad I just restarted again and the problem seems not appear anymore. Good job thans for your work.

tidusjar commented 5 years ago

Since I now know it's the scheduling system, i'm going to revert some of my changes I made to attempt to fix this.

Daedilus commented 5 years ago

I'm still having issues with a DB being locked. I deleted the schedules.db and all is well for a bit then it happens again.

`Valid options are:
Ombi 4.0.4364-featurev4
Copyright (C) 2019 Ombi

--host (Default: http://*:5000) Set to a semicolon-separated (;) list
of URL prefixes to which the server should respond. For example,
http://localhost:123. Use "*" to indicate that the server should
listen for requests on any IP address or hostname using the
specified port and protocol (for example, http://*:5000). The
protocol (http:// or https://) must be included with each URL.
Supported formats vary between servers.

--storage Storage path, where we save the logs and database

--baseurl The base URL for reverse proxy scenarios

--demo Demo mode, you will never need to use this, fuck that fruit
company...

--help Display this help screen.

--version Display version information.

We are running on

i
Hosting environment: Production
Content root path: /opt/ombi
Now listening on: http://[::]:3579
Application started. Press Ctrl+C to shut down.
fail: Ombi.ErrorHandlingMiddleware[0]
Something bad happened, ErrorMiddleware caught this
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 5: 'database is locked'.

at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteNonQuery()
at Microsoft.Data.Sqlite.SqliteConnectionExtensions.ExecuteNonQuery(SqliteConnection connection, String commandText)
at Microsoft.Data.Sqlite.SqliteTransaction.Commit()
at Microsoft.EntityFrameworkCore.Storage.RelationalTransaction.Commit()
at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(DbContext _, ValueTuple`2 parameters, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(IReadOnlyList`1 entriesToSave, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Identity.EntityFrameworkCore.UserStore`9.UpdateAsync(TUser user, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Identity.UserManager`1.UpdateUserAsync(TUser user)
at Ombi.Controllers.V1.TokenController.CreateToken(Boolean rememberMe, OmbiUser user) in C:\projects\requestplex\src\Ombi\Controllers\V1\TokenController.cs:line 151
at Ombi.Controllers.V1.TokenController.GetToken(UserAuthModel model) in C:\projects\requestplex\src\Ombi\Controllers\V1\TokenController.cs:line 70
at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)

at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync()
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter()
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync()
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync()
at Microsoft.AspNetCore.Routing.EndpointMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIIndexMiddleware.Invoke(HttpContext httpContext)
at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.InvokeCore(HttpContext context)
at Ombi.ApiKeyMiddlewear.Invoke(HttpContext context) in C:\projects\requestplex\src\Ombi\ApiKeyMiddlewear.cs:line 51
at Ombi.ErrorHandlingMiddleware.Invoke(HttpContext context) in C:\projects\requestplex\src\Ombi\ErrorHandlingMiddlewear.cs:line 24
fail: Ombi.ErrorHandlingMiddleware[0]
Something bad happened, ErrorMiddleware caught this
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 5: 'database is locked'.

at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteNonQuery()
at Microsoft.Data.Sqlite.SqliteConnectionExtensions.ExecuteNonQuery(SqliteConnection connection, String commandText)
at Microsoft.Data.Sqlite.SqliteTransaction.Commit()
at Microsoft.EntityFrameworkCore.Storage.RelationalTransaction.Commit()
at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(DbContext _, ValueTuple`2 parameters, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(IReadOnlyList`1 entriesToSave, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Identity.EntityFrameworkCore.UserStore`9.UpdateAsync(TUser user, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Identity.UserManager`1.UpdateUserAsync(TUser user)
at Ombi.Controllers.V1.TokenController.CreateToken(Boolean rememberMe, OmbiUser user) in C:\projects\requestplex\src\Ombi\Controllers\V1\TokenController.cs:line 151
at Ombi.Controllers.V1.TokenController.GetToken(UserAuthModel model) in C:\projects\requestplex\src\Ombi\Controllers\V1\TokenController.cs:line 70
at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)

at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync()
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter()
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync()
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync()
at Microsoft.AspNetCore.Routing.EndpointMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIIndexMiddleware.Invoke(HttpContext httpContext)
at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.InvokeCore(HttpContext context)
at Ombi.ApiKeyMiddlewear.Invoke(HttpContext context) in C:\projects\requestplex\src\Ombi\ApiKeyMiddlewear.cs:line 51
at Ombi.ErrorHandlingMiddleware.Invoke(HttpContext context) in C:\projects\requestplex\src\Ombi\ErrorHandlingMiddlewear.cs:line 24`
lucacri commented 5 years ago

Same for me

tidusjar commented 5 years ago

Delete the schedule db. The other guy is running v4 which is not yet ready.

danstraughn commented 5 years ago

Still having the same issue, i have to delete schedule db every day for this to work, any work around to make this an automated task? It's becoming a pain in the butt. I really love this app just want to make it work 100% of the time. Any suggestions would be greatly appreciated.

lucacri commented 5 years ago

I'm in the same boat as @danstraughn, I can keep on play whack-a-mole and delete+restart it, but it's not feasible

estavez commented 5 years ago

Same here, isn't it possible to do an easy rollback to an earlier version of the ombi app till this gets fixed?

Please advice if possible as this early fix as others also are saying is really becoming an unstable resolution for us all. But keep in mind that we need to keep our db, so if it is possible to just revert the app (not the db or settings). As the others say, love you app and I have also donated to keep your development, but we would like to see some kind of other possible solution soon on the app until this is fixed.

tidusjar commented 5 years ago

Can someone please send me their schedules db when it causes the issue.

In Dev branch it will fix the issue on a restart.

hacktek commented 5 years ago

I'm running 3.0.4256 and have not seen the issues from before. I mostly call requests via the mellow discord bot if that makes a difference. Something that I have noticed is that sometimes shows get added to Sonarr with no seasons monitored, either via the bot or manually. There doesn't seem to be any rhyme or reason to it and I'm pretty sure this started around the time I updated to the dev branch, which I've only done once on the version posted above.

danstraughn commented 5 years ago

Can someone please send me their schedules db when it causes the issue.

In Dev branch it will fix the issue on a restart.

I will zip it and send it to you in the AM when the issue will happen again.

danstraughn commented 5 years ago

Can someone please send me their schedules db when it causes the issue. In Dev branch it will fix the issue on a restart.

I will zip it and send it to you in the AM when the issue will happen again.

Here is the schedules db as requested. Just rename the extension from .d_ to .db.

Thanks for all your help.

Schedules.zip

gamechld commented 5 years ago

Same here, isn't it possible to do an easy rollback to an earlier version of the ombi app till this gets fixed?

Please advice if possible as this early fix as others also are saying is really becoming an unstable resolution for us all. But keep in mind that we need to keep our db, so if it is possible to just revert the app (not the db or settings). As the others say, love you app and I have also donated to keep your development, but we would like to see some kind of other possible solution soon on the app until this is fixed.

@estavez Master Branch version 3988 should be stable.

casperse commented 5 years ago

Same here again, replacing schedule didnt help - replacing the setting file did? Running version 3.0.4256 docker Seems that after a while you just cant login?

jasongi commented 5 years ago

My work-around was to add a cronjob to delete Schedules.db and restart the docker container everyday:

crontab -e
# add the following line
22 2 * * * /bin/rm /<ombi config folder>/Schedules.db && /usr/bin/docker restart <ombi docker container name>

Obviously only works if you're using the docker container, a slightly different command would be needed if you're running directly.

tidusjar commented 5 years ago

This has been fixed in the develop branch! 🎉 🎈

I have now replaced the scheduling system in Ombi! We are now using Quartz.Net rather than hangfire (Hangfire was causing this issue).

Please install dev and check it out!

ChrisMiller128 commented 5 years ago

Version | 3.0.4437

Centos 7

Logs Attached

Crashed here:

   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync()
   at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
   at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIIndexMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.InvokeCore(HttpContext context)
   at Ombi.ApiKeyMiddlewear.Invoke(HttpContext context) in C:\projects\requestplex\src\Ombi\ApiKeyMiddlewear.cs:line 51
   at Ombi.ErrorHandlingMiddleware.Invoke(HttpContext context) in C:\projects\requestplex\src\Ombi\ErrorHandlingMiddlewear.cs:line 24

Unhandled Exception: Microsoft.Data.Sqlite.SqliteException: SQLite Error 5: 'database is locked'.
   at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
   at Microsoft.Data.Sqlite.SqliteCommand.PrepareAndEnumerateStatements(Stopwatch timer)+MoveNext()
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.ExecuteAsync(IRelationalConnection connection, DbCommandMethod executeMethod, IReadOnlyDictionary`2 parameterValues, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator.BufferlessMoveNext(DbContext _, Boolean buffer, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator.MoveNext(CancellationToken cancellationToken)
   at System.Linq.AsyncEnumerable.FirstOrDefault_[TSource](IAsyncEnumerable`1 source, CancellationToken cancellationToken) in D:\a\1\s\Ix.NET\Source\System.Interactive.Async\First.cs:line 144
   at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.TaskResultAsyncEnumerable`1.Enumerator.MoveNext(CancellationToken cancellationToken)
   at System.Linq.AsyncEnumerable.SelectEnumerableAsyncIterator`2.MoveNextCore(CancellationToken cancellationToken) in D:\a\1\s\Ix.NET\Source\System.Interactive.Async\Select.cs:line 106
   at System.Linq.AsyncEnumerable.AsyncIterator`1.MoveNext(CancellationToken cancellationToken) in D:\a\1\s\Ix.NET\Source\System.Interactive.Async\AsyncIterator.cs:line 98
   at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.MoveNext(CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.ExecuteSingletonAsyncQuery[TResult](QueryContext queryContext, Func`2 compiledQuery, IDiagnosticsLogger`1 logger, Type contextType)
   at Ombi.Core.Engine.MovieRequestEngine.CheckForSubscription(HideResult shouldHide, MovieRequests x) in C:\projects\requestplex\src\Ombi.Core\Engine\MovieRequestEngine.cs:line 271
   at Ombi.Core.Engine.MovieRequestEngine.<>c__DisplayClass15_0.<<GetRequests>b__5>d.MoveNext() in C:\projects\requestplex\src\Ombi.Core\Engine\MovieRequestEngine.cs:line 194
--- End of stack trace from previous location where exception was thrown ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
Aborted

Now when trying to add a new show:

2019-04-18 00:34:23.455 -04:00 [Error] Something bad happened, ErrorMiddleware caught this
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 5: 'database is locked'.
   at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteNonQuery()
   at Microsoft.Data.Sqlite.SqliteConnectionExtensions.ExecuteNonQuery(SqliteConnection connection, String commandText)
   at Microsoft.Data.Sqlite.SqliteTransaction.Commit()
   at Microsoft.EntityFrameworkCore.Storage.RelationalTransaction.Commit()
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(DbContext _, ValueTuple`2 parameters, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(IReadOnlyList`1 entriesToSave, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
   at Ombi.Store.Repository.Requests.TvRequestRepository.InternalSaveChanges() in C:\projects\requestplex\src\Ombi.Store\Repository\Requests\TvRequestRepository.cs:line 157
   at Ombi.Store.Repository.Requests.TvRequestRepository.Add(TvRequests request) in C:\projects\requestplex\src\Ombi.Store\Repository\Requests\TvRequestRepository.cs:line 111
   at Ombi.Core.Engine.TvRequestEngine.AddRequest(TvRequests model) in C:\projects\requestplex\src\Ombi.Core\Engine\TvRequestEngine.cs:line 558
   at Ombi.Core.Engine.TvRequestEngine.RequestTvShow(TvRequestViewModel tv) in C:\projects\requestplex\src\Ombi.Core\Engine\TvRequestEngine.cs:line 131
   at Ombi.Controllers.RequestController.RequestTv(TvRequestViewModel tv) in C:\projects\requestplex\src\Ombi\Controllers\RequestController.cs:line 285
   at lambda_method(Closure , Object )
   at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync()
   at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
   at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIIndexMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.InvokeCore(HttpContext context)
   at Ombi.ApiKeyMiddlewear.Invoke(HttpContext context) in C:\projects\requestplex\src\Ombi\ApiKeyMiddlewear.cs:line 51
   at Ombi.ErrorHandlingMiddleware.Invoke(HttpContext context) in C:\projects\requestplex\src\Ombi\ErrorHandlingMiddlewear.cs:line 24
2019-04-18 00:34:28.287 -04:00 [Debug] Batch acquisition of 0 triggers
2019-04-18 00:34:51.323 -04:00 [Debug] Batch acquisition of 1 triggers
2019-04-18 00:35:00.005 -04:00 [Debug] Calling Execute on job DVR.ISickRageSync
2019-04-18 00:35:00.010 -04:00 [Debug] Batch acquisition of 1 triggers
2019-04-18 00:35:00.079 -04:00 [Debug] Trigger instruction : NoInstruction
2019-04-18 00:35:01.001 -04:00 [Debug] Batch acquisition of 1 triggers
2019-04-18 00:35:01.001 -04:00 [Debug] Calling Execute on job DVR.IRadarrSync
2019-04-18 00:35:01.002 -04:00 [Debug] Calling Execute on job DVR.ISonarrSync
2019-04-18 00:35:01.002 -04:00 [Debug] Batch acquisition of 1 triggers
2019-04-18 00:35:01.003 -04:00 [Debug] Trigger instruction : NoInstruction
2019-04-18 00:35:01.012 -04:00 [Debug] Calling Execute on job System.IResendFailedRequests
2019-04-18 00:35:01.019 -04:00 [Debug] Batch acquisition of 0 triggers
2019-04-18 00:35:22.740 -04:00 [Debug] Trigger instruction : NoInstruction
2019-04-18 00:35:28.498 -04:00 [Debug] Batch acquisition of 0 triggers
2019-04-18 00:35:49.734 -04:00 [Information] Default Quartz.NET properties loaded from embedded resource file
2019-04-18 00:35:50.018 -04:00 [Debug] TaskSchedulingThreadPool configured with max concurrency of 10 and TaskScheduler ThreadPoolTaskScheduler.
2019-04-18 00:35:50.054 -04:00 [Information] Initialized Scheduler Signaller of type: Quartz.Core.SchedulerSignalerImpl
2019-04-18 00:35:50.074 -04:00 [Information] Quartz Scheduler v."3.0.7.0" created.
2019-04-18 00:35:50.081 -04:00 [Information] RAMJobStore initialized.
2019-04-18 00:35:50.119 -04:00 [Information] Scheduler meta-data: Quartz Scheduler (v3.0.7.0) 'DefaultQuartzScheduler' with instanceId 'NON_CLUSTERED'
  Scheduler class: 'Quartz.Core.QuartzScheduler' - running locally.
  NOT STARTED.
  Currently in standby mode.
  Number of jobs executed: 0
  Using thread pool 'Quartz.Simpl.DefaultThreadPool' - with 10 threads.
  Using job-store 'Quartz.Simpl.RAMJobStore' - which does not support persistence. and is not clustered.

log-20190418.txt

5drH64gDnDJb commented 5 years ago

After updating to 3.0.4437 now I'm getting database locks again

log-20190418.txt

simon021 commented 5 years ago

Database locks again here as well. Can I provide any specific logs that would be helpful? After a container redeployment it seems to be working again.

tidusjar commented 5 years ago

Does this happen on 3.0.4489?

jeffkeller87 commented 5 years ago

~I haven't had any issues on 3.0.4489 or 3.0.4522. Ran the former for about 5 days without issue.~

lastb0isct commented 5 years ago

Having this issue with Ombi 3.0.4256-master docker container. Removing schedules.db does not fix the issue.

jeffkeller87 commented 5 years ago

Originally, in my case, database locks were preventing users from logging in (throwing a bad password message). Now that I am on 3.0.4522, I don't have this particular issue.

But I am now getting database lock messages in the logs when trying to approve requests. When clicking "Approve", the button changes to "Mark Available" but no notification ever appears indicating that the approval went through. If I log out and then log back in, the button has changed back to "Approve" and no new entries have been added to Sonarr/Radarr. Examining the logs shows:

2019-05-03 16:20:20.511 -04:00 [Error] Something bad happened, ErrorMiddleware caught this
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 5: 'database is locked'.
   at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteNonQuery()
   at Microsoft.Data.Sqlite.SqliteConnectionExtensions.ExecuteNonQuery(SqliteConnection connection, String commandText)
   at Microsoft.Data.Sqlite.SqliteTransaction.Commit()
   at Microsoft.EntityFrameworkCore.Storage.RelationalTransaction.Commit()
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(DbContext _, ValueTuple`2 parameters, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(IReadOnlyList`1 entriesToSave, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
   at Ombi.Store.Repository.Requests.TvRequestRepository.InternalSaveChanges() in C:\projects\requestplex\src\Ombi.Store\Repository\Requests\TvRequestRepository.cs:line 157
   at Ombi.Store.Repository.Requests.TvRequestRepository.UpdateChild(ChildRequests request) in C:\projects\requestplex\src\Ombi.Store\Repository\Requests\TvRequestRepository.cs:line 152
   at Ombi.Core.Engine.TvRequestEngine.ApproveChildRequest(Int32 id) in C:\projects\requestplex\src\Ombi.Core\Engine\TvRequestEngine.cs:line 389
   at Ombi.Controllers.RequestController.ApproveChild(TvUpdateModel model) in C:\projects\requestplex\src\Ombi\Controllers\RequestController.cs:line 418
   at lambda_method(Closure , Object )
   at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync()
   at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
   at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIIndexMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext)
   at Ombi.ApiKeyMiddlewear.Invoke(HttpContext context) in C:\projects\requestplex\src\Ombi\ApiKeyMiddlewear.cs:line 51
   at Ombi.ErrorHandlingMiddleware.Invoke(HttpContext context) in C:\projects\requestplex\src\Ombi\ErrorHandlingMiddlewear.cs:line 24
Arindrew commented 5 years ago

I'm having the same problem as Jeff now, except I am on 3.0.4434 (develop).

5drH64gDnDJb commented 5 years ago

Version 3.0.4538, you can login but has issues as soon as you try to request something.

log-20190506.txt

lastb0isct commented 5 years ago

Getting a database locked error on my docker image:

Linuxserver.io version:- v3.0.4256-ls17 Build-date:- 2019-05-07T07:23:55+01:00

      Something bad happened, ErrorMiddleware caught this,
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 5: 'database is locked'.,
   at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db),
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior),
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteNonQuery(),
   at Microsoft.Data.Sqlite.SqliteConnectionExtensions.ExecuteNonQuery(SqliteConnection connection, String commandText),
   at Microsoft.Data.Sqlite.SqliteTransaction.Commit(),
   at Microsoft.EntityFrameworkCore.Storage.RelationalTransaction.Commit(),
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(DbContext _, ValueTuple`2 parameters, CancellationToken cancellationToken),
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(IReadOnlyList`1 entriesToSave, CancellationToken cancellationToken),
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken),
   at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken),
   at Microsoft.AspNetCore.Identity.EntityFrameworkCore.UserStore`9.UpdateAsync(TUser user, CancellationToken cancellationToken),
   at Microsoft.AspNetCore.Identity.UserManager`1.UpdateUserAsync(TUser user),
   at Ombi.Controllers.TokenController.CreateToken(Boolean rememberMe, OmbiUser user) in C:\projects\requestplex\src\Ombi\Controllers\TokenController.cs:line 127,
   at Ombi.Controllers.TokenController.GetToken(UserAuthModel model) in C:\projects\requestplex\src\Ombi\Controllers\TokenController.cs:line 72,
   at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments),
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync(),
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync(),
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context),
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted),
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync(),
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter(),
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context),
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted),
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync(),
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync(),
   at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext),
   at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context),
   at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIIndexMiddleware.Invoke(HttpContext httpContext),
   at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext),
   at Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.InvokeCore(HttpContext context),
   at Ombi.ApiKeyMiddlewear.Invoke(HttpContext context) in C:\projects\requestplex\src\Ombi\ApiKeyMiddlewear.cs:line 51,
   at Ombi.ErrorHandlingMiddleware.Invoke(HttpContext context) in C:\projects\requestplex\src\Ombi\ErrorHandlingMiddlewear.cs:line 24,

Deleted the Schedules.db and it let me in, going to verify that it sticks this time.

Yep, still getting the same error as above after only a day.

darkcloud784 commented 5 years ago

I seem to be having the same issue. and as @lastb0isct pointed out after I delete the schedules database and restart ombi it works again, able to log in and request but after about 24 hours or so it just seems to go back to locking the db.

2019-05-16 20:35:21.775 -05:00 [Error] Something bad happened, ErrorMiddleware caught this
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 5: 'database is locked'.
   at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
   at Microsoft.Data.Sqlite.SqliteCommand.PrepareAndEnumerateStatements(Stopwatch timer)+MoveNext()
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.ExecuteAsync(IRelationalConnection connection, DbCommandMethod executeMethod, IReadOnlyDictionary`2 parameterValues, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator.BufferlessMoveNext(DbContext _, Boolean buffer, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator.MoveNext(CancellationToken cancellationToken)
   at System.Linq.AsyncEnumerable.FirstOrDefault_[TSource](IAsyncEnumerable`1 source, CancellationToken cancellationToken) in D:\a\1\s\Ix.NET\Source\System.Interactive.Async\First.cs:line 144
   at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.TaskResultAsyncEnumerable`1.Enumerator.MoveNext(CancellationToken cancellationToken)
   at System.Linq.AsyncEnumerable.SelectEnumerableAsyncIterator`2.MoveNextCore(CancellationToken cancellationToken) in D:\a\1\s\Ix.NET\Source\System.Interactive.Async\Select.cs:line 106
   at System.Linq.AsyncEnumerable.AsyncIterator`1.MoveNext(CancellationToken cancellationToken) in D:\a\1\s\Ix.NET\Source\System.Interactive.Async\AsyncIterator.cs:line 98
   at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.MoveNext(CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.ExecuteSingletonAsyncQuery[TResult](QueryContext queryContext, Func`2 compiledQuery, IDiagnosticsLogger`1 logger, Type contextType)
   at Microsoft.AspNetCore.Identity.UserManager`1.FindByNameAsync(String userName)
   at Ombi.Controllers.TokenController.DoesUserRequireAPassword(UserAuthModel model) in C:\projects\requestplex\src\Ombi\Controllers\TokenController.cs:line 222
   at lambda_method(Closure , Object )
   at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync()
   at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
   at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIIndexMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.InvokeCore(HttpContext context)
   at Ombi.ApiKeyMiddlewear.Invoke(HttpContext context) in C:\projects\requestplex\src\Ombi\ApiKeyMiddlewear.cs:line 51
   at Ombi.ErrorHandlingMiddleware.Invoke(HttpContext context) in C:\projects\requestplex\src\Ombi\ErrorHandlingMiddlewear.cs:line 24
2019-05-16 20:35:40.180 -05:00 [Error] Something bad happened, ErrorMiddleware caught this
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 5: 'database is locked'.
   at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteNonQuery()
   at Microsoft.Data.Sqlite.SqliteConnectionExtensions.ExecuteNonQuery(SqliteConnection connection, String commandText)
   at Microsoft.Data.Sqlite.SqliteTransaction.Commit()
   at Microsoft.EntityFrameworkCore.Storage.RelationalTransaction.Commit()
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(DbContext _, ValueTuple`2 parameters, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(IReadOnlyList`1 entriesToSave, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Identity.EntityFrameworkCore.UserStore`9.UpdateAsync(TUser user, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Identity.UserManager`1.UpdateUserAsync(TUser user)
   at Ombi.Controllers.TokenController.CreateToken(Boolean rememberMe, OmbiUser user) in C:\projects\requestplex\src\Ombi\Controllers\TokenController.cs:line 127
   at Ombi.Controllers.TokenController.GetToken(UserAuthModel model) in C:\projects\requestplex\src\Ombi\Controllers\TokenController.cs:line 72
   at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync()
   at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
   at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIIndexMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.InvokeCore(HttpContext context)
   at Ombi.ApiKeyMiddlewear.Invoke(HttpContext context) in C:\projects\requestplex\src\Ombi\ApiKeyMiddlewear.cs:line 51
   at Ombi.ErrorHandlingMiddleware.Invoke(HttpContext context) in C:\projects\requestplex\src\Ombi\ErrorHandlingMiddlewear.cs:line 24
casperse commented 5 years ago

Same issue cant login what can I do? replace some files (I have weekly backup) Update replaced schedules.db and restarted and I can login again (Sorry forgot this been some time since I had this problem)

lisim commented 5 years ago

Also now getting this from the debian repo

tidusjar commented 5 years ago

For people who are having the original issue. Upgrade to develop.

I am closing this since the original issue has been fixed.

If you are having issues with the develop branch please raise a new issue and follow the issue template

RyanEwen commented 5 years ago

Anyone know if the linuxserver containers have this fix in them? https://hub.docker.com/r/linuxserver/ombi/tags

EDIT there's a development tag. I'll try that.

lastb0isct commented 5 years ago

development tag fixed it for me in docker

derekross commented 5 years ago

I'm on linuxservers development tag, but still getting the authentication loop. I don't see a schedules.db inside my /config directory to delete? Is it somewhere else?

CountParadox commented 5 years ago

linuxserver/development and issue is still present for me

ZuluWhiskey commented 5 years ago

Pretty sure I'm also having this issue but I'm on master/3.0.4680 - Users cannot log in until I restart the ombi service. It works for a currently undetermined amount of time and then breaks and I have to restart the service again. I've tried downgrading a few versions but still get the same issues... (System: Ubuntu 16.04.6 LTS)

nonissue commented 4 years ago

@ZuluWhiskey I'm having similar issues, logins were sometimes failing and other slowness/failures were happening (ex. requests could be created, but the 'requests' view wouldn't show the new requests). Logs all point to sqlite db lock issues.

A potential solution is manually backing up the sqlite databases and replacing the existing databases with the backups. I did that tonight, and everything seems to be working, no errors in my logs yet. I can type up some quick instructions on the process if anyone wants them. I'll also follow up if the errors return.

nonissue commented 4 years ago

@ZuluWhiskey 20 hours later and things are still stable, looking promising.

ZuluWhiskey commented 4 years ago

@nonissue That sounds pretty positive! How did you achieve this as I don’t quite follow your initial response with regards to backing up and then utilising said backup? (Unless I’ve misunderstood of course!)

danielcbaldwin commented 4 years ago

@nonissue I am having similar issues and would love to know in more detail how you solved it also. Thanks!

nonissue commented 4 years ago

Ah so the sqlite backup of the databases didn't work -- the errors started happening after about 15-16 hours, but I tried some other stuff last night and it might be resolved? I can't remember exactly what I did, but if no errors pop up by tomorrow, I'll retrace my steps and update you folks @danielcbaldwin @ZuluWhiskey.