ironmansoftware / powershell-universal

Issue tracker for PowerShell Universal
https://powershelluniversal.com
35 stars 2 forks source link

Errors with LiteDB when running in Azure #825

Closed adamdriscoll closed 2 years ago

adamdriscoll commented 2 years ago

Steps to Reproduce

https://forums.ironmansoftware.com/t/script-jobs-stuck-on-canceling/5552/11

Expected behavior

LiteDB does not present errors when running in Azure.

Actual behavior

LiteDB is throwing exceptions when running in Azure which is causing problems.

Environment data

PSU 2.6.2

Visuals

No response

adamdriscoll commented 2 years ago

This issue has been mentioned on Ironman Software Forums. There might be relevant details there:

https://forums.ironmansoftware.com/t/script-jobs-stuck-on-canceling/5552/10

adamdriscoll commented 2 years ago

I can reproduce this when trying to restart a dashboard.

2022-01-12 17:36:23.774 +00:00 [ERR] Connection id "0HMELTP1GDGJV", Request id "0HMELTP1GDGJV:00000028": An unhandled exception was thrown by the application.
System.Exception: LiteDB ENSURE: transaction must be active to rollback (current state: Disposed)
   at LiteDB.Constants.ENSURE(Boolean conditional, String message)
   at LiteDB.Engine.TransactionService.Rollback()
   at LiteDB.Engine.LiteEngine.AutoTransaction[T](Func`2 fn)
   at LiteDB.LiteCollection`1.Insert(T entity)
   at LiteDB.LiteRepository.Insert[T](T entity, String collectionName)
   at UniversalAutomation.LiteDBTable`1.Insert(T item) in C:\src\universal\src\UniversalAutomation.LiteDBv5\LiteDBDatabase.cs:line 508
   at UniversalAutomation.DashboardController.RestartAsync(Int64 id) in C:\src\universal\src\Universal.Server\Controllers\DashboardController.cs:line 225
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   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()
adamdriscoll commented 2 years ago

LiteDB is throwing an exception but not logging what it actually is. This rollback exception is a result of the original exception. We need to determine what the original exception is.