ironmansoftware / issues

Public Issue tracker for Ironman Software products.
https://ironmansoftware.com
32 stars 2 forks source link

System crash - Git - An item with the same key has already been added #3351

Closed ksl28 closed 1 month ago

ksl28 commented 1 month ago

Version

4.2.19

Severity

Medium

Environment

Container

Steps to Reproduce

During an update to the PSU dashboard and a push to Git, the entire PSU container crashed. After expecting it with docker logs we saw this error message:

[08:21:40 FTL] Failed to start PowerShell Universal.
System.ArgumentException: An item with the same key has already been added. Key: /PowerShellUniversal.GitSettingsService/GetSettings
   at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
   at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
   at Grpc.Core.Server.AddServiceDefinitionInternal(ServerServiceDefinition serviceDefinition)
   at Grpc.Core.Server.ServiceDefinitionCollection.Add(ServerServiceDefinition serviceDefinition)
   at ProtoBuf.Grpc.Server.ServiceDefinitionCollectionExtensions.AddCodeFirstImpl(ServiceDefinitionCollection services, Object service, Type serviceType, BinderConfiguration binderConfiguration, TextWriter log, IEnumerable`1 interceptors) in /_/src/protobuf-net.Grpc.Native/Server/ServiceDefinitionCollectionExtensions.cs:line 61
   at ProtoBuf.Grpc.Server.ServiceDefinitionCollectionExtensions.AddCodeFirst[TService](ServiceDefinitionCollection services, TService service, BinderConfiguration binderConfiguration, TextWriter log, IEnumerable`1 interceptors) in /_/src/protobuf-net.Grpc.Native/Server/ServiceDefinitionCollectionExtensions.cs:line 33
   at PowerShellUniversal.Client.StartAsync() in C:\actions-runner\_work\universal\universal\src\Universal.Server\Services\Client.cs:line 66
   at UniversalAutomation.StartupService.RunStartup() in C:\actions-runner\_work\universal\universal\src\Universal.Server\Services\StartupService.cs:line 339
   at UniversalAutomation.StartupService.TryRunStartup() in C:\actions-runner\_work\universal\universal\src\Universal.Server\Services\StartupService.cs:line 265

Tried to find the appsettings.json to disable Git, but couldnt find it in the docker volume - if it exists, then please update the documenation - https://docs.powershelluniversal.com/config/settings

The "fix" was to delete everything from these SQL tables: GitStatus GitSettings

Now the container can start again, and we can now create a new repository for this.

Expected behavior

That it would fail to push to Git, but if it does, then the system shouldnt fail to start - it should start up, and then give a warning to the admin that something is wrong.

So change the default approach on this, and if someone wants their application to shutdown again if the Git respository is not available, then add an option for that. :)

Actual behavior

If the Git repo / settings are not correct, the entire system fails to start.

Additional Environment data

No response

Screenshots/Animations

No response