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

[BUG] Lingarr tries to access sqlite database even when mysql is set up #65

Closed
byrongamatos opened this issue Jan 22, 2025 · 5 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@byrongamatos
Copy link

Describe the problem

I am trying to set up lingarr with mysql database. This works, the mysql database is populated with tables and data. But the application throws the following exception and i cannot create tasks for translation

`[2025-01-22 09:01:54] [Error] Microsoft.AspNetCore.Server.Kestrel: Connection id "0HN9QO6O5C1F9", Request id "0HN9QO6O5C1F9:0000000D": An unhandled exception was thrown by the application.

SQLite.SQLiteException: database disk image is malformed

at SQLite.PreparedSqlLiteInsertCommand.ExecuteNonQuery(Object[] source)

at SQLite.SQLiteConnection.Insert(Object obj, String extra, Type objType)

at Hangfire.Storage.SQLite.SQLiteDistributedLock.TryAcquireLock()

at Hangfire.Storage.SQLite.SQLiteDistributedLock.Acquire(TimeSpan timeout)

at Hangfire.Storage.SQLite.Retry.Execute[TResult](Func`2 func, CancellationToken token, TimeSpan[] delays)

at Hangfire.Storage.SQLite.HangfireSQLiteConnection.AcquireDistributedLock(String resource, TimeSpan timeout)

at Hangfire.RecurringJobExtensions.AcquireDistributedRecurringJobLock(IStorageConnection connection, String recurringJobId, TimeSpan timeout) in C:\projects\hangfire-525\src\Hangfire.Core\RecurringJobExtensions.cs:line 39

at Hangfire.RecurringJobManager.TriggerJob(String recurringJobId) in C:\projects\hangfire-525\src\Hangfire.Core\RecurringJobManager.cs:line 179

at Hangfire.RecurringJob.TriggerJob(String recurringJobId) in C:\projects\hangfire-525\src\Hangfire.Core\RecurringJob.cs:line 636

at Lingarr.Server.Controllers.ScheduleController.StartJob(StartJobRequest recurringJob) in /src/Lingarr.Server/Controllers/ScheduleController.cs:line 42

at lambda_method897(Closure, Object, Object[])

at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncActionResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)

at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()

at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)

at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()

--- End of stack trace from previous location ---

at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)

at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)

at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()

--- End of stack trace from previous location ---

at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)

at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)

at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)

at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)

at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)

at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)

[2025-01-22 09:05:24] [Information] Lingarr.Server.Services.Translation.LibreService: Retrieving /app/Statics/libre_translate_languages.json languages

[2025-01-22 09:07:19] [Error] Hangfire.Server.Worker: 10 state change attempt(s) failed due to an exception, moving job to the FailedState

SQLite.SQLiteException: database disk image is malformed

at SQLite.PreparedSqlLiteInsertCommand.ExecuteNonQuery(Object[] source)

at SQLite.SQLiteConnection.Insert(Object obj, String extra, Type objType)

at Hangfire.Storage.SQLite.SQLiteDistributedLock.TryAcquireLock()

at Hangfire.Storage.SQLite.SQLiteDistributedLock.Acquire(TimeSpan timeout)

at Hangfire.Storage.SQLite.Retry.Execute[TResult](Func`2 func, CancellationToken token, TimeSpan[] delays)

at Hangfire.Storage.SQLite.HangfireSQLiteConnection.AcquireDistributedLock(String resource, TimeSpan timeout)

at Hangfire.Storage.StorageConnectionExtensions.AcquireDistributedJobLock(IStorageConnection connection, String jobId, TimeSpan timeout) in C:\projects\hangfire-525\src\Hangfire.Core\Storage\StorageConnectionExtensions.cs:line 33

at Hangfire.States.BackgroundJobStateChanger.ChangeState(StateChangeContext context) in C:\projects\hangfire-525\src\Hangfire.Core\States\BackgroundJobStateChanger.cs:line 69

at Hangfire.Server.Worker.TryChangeState(BackgroundProcessContext context, IStorageConnection connection, String jobId, IState state, IReadOnlyDictionary`2 customData, String[] expectedStates, IFetchedJob completeJob, BackgroundJob& backgroundJob, CancellationToken initializeToken, CancellationToken abortToken) in C:\projects\hangfire-525\src\Hangfire.Core\Server\Worker.cs:line 235

[2025-01-22 09:08:13] [Error] Hangfire.Server.Worker: 10 state change attempt(s) failed due to an exception, moving job to the FailedState

SQLite.SQLiteException: database disk image is malformed

at SQLite.PreparedSqlLiteInsertCommand.ExecuteNonQuery(Object[] source)

at SQLite.SQLiteConnection.Insert(Object obj, String extra, Type objType)

at Hangfire.Storage.SQLite.SQLiteDistributedLock.TryAcquireLock()

at Hangfire.Storage.SQLite.SQLiteDistributedLock.Acquire(TimeSpan timeout)

at Hangfire.Storage.SQLite.Retry.Execute[TResult](Func`2 func, CancellationToken token, TimeSpan[] delays)

at Hangfire.Storage.SQLite.HangfireSQLiteConnection.AcquireDistributedLock(String resource, TimeSpan timeout)

at Hangfire.Storage.StorageConnectionExtensions.AcquireDistributedJobLock(IStorageConnection connection, String jobId, TimeSpan timeout) in C:\projects\hangfire-525\src\Hangfire.Core\Storage\StorageConnectionExtensions.cs:line 33

at Hangfire.States.BackgroundJobStateChanger.ChangeState(StateChangeContext context) in C:\projects\hangfire-525\src\Hangfire.Core\States\BackgroundJobStateChanger.cs:line 69

at Hangfire.Server.Worker.TryChangeState(BackgroundProcessContext context, IStorageConnection connection, String jobId, IState state, IReadOnlyDictionary`2 customData, String[] expectedStates, IFetchedJob completeJob, BackgroundJob& backgroundJob, CancellationToken initializeToken, CancellationToken abortToken) in C:\projects\hangfire-525\src\Hangfire.Core\Server\Worker.cs:line 235

[2025-01-22 09:08:14] [Error] Hangfire.Processing.BackgroundExecution: Execution Worker is in the Failed state now due to an exception, execution will be retried in no more than 00:00:04

SQLite.SQLiteException: database disk image is malformed

at SQLite.PreparedSqlLiteInsertCommand.ExecuteNonQuery(Object[] source)

at SQLite.SQLiteConnection.Insert(Object obj, String extra, Type objType)

at Hangfire.Storage.SQLite.SQLiteDistributedLock.TryAcquireLock()

at Hangfire.Storage.SQLite.SQLiteDistributedLock.Acquire(TimeSpan timeout)

at Hangfire.Storage.SQLite.Retry.Execute[TResult](Func`2 func, CancellationToken token, TimeSpan[] delays)

at Hangfire.Storage.SQLite.HangfireSQLiteConnection.AcquireDistributedLock(String resource, TimeSpan timeout)

at Hangfire.Storage.StorageConnectionExtensions.AcquireDistributedJobLock(IStorageConnection connection, String jobId, TimeSpan timeout) in C:\projects\hangfire-525\src\Hangfire.Core\Storage\StorageConnectionExtensions.cs:line 33

at Hangfire.States.BackgroundJobStateChanger.ChangeState(StateChangeContext context) in C:\projects\hangfire-525\src\Hangfire.Core\States\BackgroundJobStateChanger.cs:line 69

at Hangfire.Server.Worker.TryChangeState(BackgroundProcessContext context, IStorageConnection connection, String jobId, IState state, IReadOnlyDictionary`2 customData, String[] expectedStates, IFetchedJob completeJob, BackgroundJob& backgroundJob, CancellationToken initializeToken, CancellationToken abortToken) in C:\projects\hangfire-525\src\Hangfire.Core\Server\Worker.cs:line 269

at Hangfire.Server.Worker.Execute(BackgroundProcessContext context) in C:\projects\hangfire-525\src\Hangfire.Core\Server\Worker.cs:line 122

at Hangfire.Server.BackgroundProcessDispatcherBuilder.ExecuteProcess(Guid executionId, Object state) in C:\projects\hangfire-525\src\Hangfire.Core\Server\BackgroundProcessDispatcherBuilder.cs:line 82

at Hangfire.Processing.BackgroundExecution.Run(Action`2 callback, Object state) in C:\projects\hangfire-525\src\Hangfire.Core\Processing\BackgroundExecution.cs:line 118

[2025-01-22 09:09:09] [Error] Hangfire.Server.Worker: 10 state change attempt(s) failed due to an exception, moving job to the FailedState

SQLite.SQLiteException: database disk image is malformed

at SQLite.PreparedSqlLiteInsertCommand.ExecuteNonQuery(Object[] source)

at SQLite.SQLiteConnection.Insert(Object obj, String extra, Type objType)

at Hangfire.Storage.SQLite.SQLiteDistributedLock.TryAcquireLock()

at Hangfire.Storage.SQLite.SQLiteDistributedLock.Acquire(TimeSpan timeout)

at Hangfire.Storage.SQLite.Retry.Execute[TResult](Func`2 func, CancellationToken token, TimeSpan[] delays)

at Hangfire.Storage.SQLite.HangfireSQLiteConnection.AcquireDistributedLock(String resource, TimeSpan timeout)

at Hangfire.Storage.StorageConnectionExtensions.AcquireDistributedJobLock(IStorageConnection connection, String jobId, TimeSpan timeout) in C:\projects\hangfire-525\src\Hangfire.Core\Storage\StorageConnectionExtensions.cs:line 33

at Hangfire.States.BackgroundJobStateChanger.ChangeState(StateChangeContext context) in C:\projects\hangfire-525\src\Hangfire.Core\States\BackgroundJobStateChanger.cs:line 69

at Hangfire.Server.Worker.TryChangeState(BackgroundProcessContext context, IStorageConnection connection, String jobId, IState state, IReadOnlyDictionary2 customData, String[] expectedStates, IFetchedJob completeJob, BackgroundJob& backgroundJob, CancellationToken initializeToken, CancellationToken abortToken) in C:\projects\hangfire-525\src\Hangfire.Core\Server\Worker.cs:line 235

Screenshots or Additional Context

No response

@byrongamatos byrongamatos added the bug Something isn't working label Jan 22, 2025
@rowanfuchs rowanfuchs self-assigned this Jan 22, 2025
@rowanfuchs
Copy link
Member

Hi, in this case the hangfire db (which manages scheduled tasks) is corrupt, you can keep the mysql data but you need to remove the existing cached image and start again, from there it should work again.

@byrongamatos
Copy link
Author

that solves the issue, but i keep getting those problems after a little while again. Is it possible to not use sqlite at all and only use mysql?

@rowanfuchs
Copy link
Member

that is definitely possible but sadly not built yet, I will look into this and see if it can be added to the next version.

@rowanfuchs rowanfuchs moved this to Backlog in Lingarr Jan 23, 2025
@byrongamatos
Copy link
Author

I investigated a bit more, it seems like Hangfire really doesnt like nfs filesystems. I moved the app to a different host and its working fine

@github-project-automation github-project-automation bot moved this from Backlog to Done in Lingarr Jan 23, 2025
@rowanfuchs
Copy link
Member

rowanfuchs commented Jan 23, 2025

I see, thank you for updating me, I think it's a framework issue, but good to know. I will still add support for mysql it should help with the general stability.

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: Done
Development

No branches or pull requests

2 participants