Service is running, but HTTP 500 error

Product: PowerShell Universal
Version: 4.2.20 / 4.2.21

Hello everyone,

I hope one of you can point me in the right direction to find or solve our error.

We have been using two PU servers since the beginning. Since Saturday evening, however, one of the two servers is no longer running properly. The service starts and runs without any problems, but the website is always called with a HTTP 500 error.

In the log I find the following on the affected server:

1:

2024-06-19 11:29:50.383 +02:00 [ERR] Failed to sync: Sequence contains no elements    at System.Linq.ThrowHelper.ThrowNoElementsException()
   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
   at PowerShellUniversal.MemoryTable`1.First() in C:\actions-runner\_work\universal\universal\src\PowerShellUniversal\MemoryTable.cs:line 54
   at UniversalAutomation.Git.GitService.GetProxyOptions() in C:\actions-runner\_work\universal\universal\src\Universal.Server\Services\GitService.cs:line 190
   at UniversalAutomation.Git.GitService.IsRemoteEmpty(GitSettings settings) in C:\actions-runner\_work\universal\universal\src\Universal.Server\Services\GitService.cs:line 359
   at UniversalAutomation.Git.GitService.Initialize() in C:\actions-runner\_work\universal\universal\src\Universal.Server\Services\GitService.cs:line 271
   at UniversalAutomation.GitSyncService.TrySync(GitStatus status, Boolean force, GitSettings settings) in C:\actions-runner\_work\universal\universal\src\Universal.Server\Services\GitSyncService.cs:line 158
   at UniversalAutomation.GitSyncService.Sync(Boolean force) in C:\actions-runner\_work\universal\universal\src\Universal.Server\Services\GitSyncService.cs:line 105

2:

2024-06-19 11:29:50.428 +02:00 [ERR] Failed to sync.
Microsoft.EntityFrameworkCore.DbUpdateConcurrencyException: The database operation was expected to affect 1 row(s), but actually affected 0 row(s); data may have been modified or deleted since entities were loaded. See http://go.microsoft.com/fwlink/?LinkId=527962 for information on understanding and handling optimistic concurrency exceptions.
   at Microsoft.EntityFrameworkCore.Update.AffectedCountModificationCommandBatch.ThrowAggregateUpdateConcurrencyException(RelationalDataReader reader, Int32 commandIndex, Int32 expectedRowsAffected, Int32 rowsAffected)
   at Microsoft.EntityFrameworkCore.Update.AffectedCountModificationCommandBatch.ConsumeResultSetWithRowsAffectedOnly(Int32 commandIndex, RelationalDataReader reader)
   at Microsoft.EntityFrameworkCore.Update.AffectedCountModificationCommandBatch.Consume(RelationalDataReader reader)
   at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection)
   at Microsoft.EntityFrameworkCore.SqlServer.Update.Internal.SqlServerModificationCommandBatch.Execute(IRelationalConnection connection)
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.Execute(IEnumerable`1 commandBatches, IRelationalConnection connection)
   at Microsoft.EntityFrameworkCore.Storage.RelationalDatabase.SaveChanges(IList`1 entries)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(IList`1 entriesToSave)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(StateManager stateManager, Boolean acceptAllChangesOnSuccess)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.<>c.<SaveChanges>b__107_0(DbContext _, ValueTuple`2 t)
   at Microsoft.EntityFrameworkCore.Storage.ExecutionStrategy.<>c__DisplayClass28_0`2.<Execute>b__0(DbContext context, TState state)
   at Microsoft.EntityFrameworkCore.Storage.ExecutionStrategy.ExecuteImplementation[TState,TResult](Func`3 operation, Func`3 verifySucceeded, TState state)
   at Microsoft.EntityFrameworkCore.Storage.ExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(Boolean acceptAllChangesOnSuccess)
   at Microsoft.EntityFrameworkCore.DbContext.SaveChanges(Boolean acceptAllChangesOnSuccess)
   at Microsoft.EntityFrameworkCore.DbContext.SaveChanges()
   at PowerShellUniversal.SQL.SqlTable`1.DeleteRange(Func`2 query) in C:\actions-runner\_work\universal\universal\src\PowerShellUniversal.SQL\Database.cs:line 708
   at UniversalAutomation.GitSyncService.Sync(Boolean force) in C:\actions-runner\_work\universal\universal\src\Universal.Server\Services\GitSyncService.cs:line 130

3:

2024-06-19 11:29:52.644 +02:00 [DBG] Connection id "0HN4G89FB5FOD" accepted.
2024-06-19 11:29:52.644 +02:00 [DBG] Connection id "0HN4G89FB5FOD" started.
2024-06-19 11:29:52.670 +02:00 [DBG] Connection 0HN4G89FB5FOD established using the following protocol: "Tls12"
2024-06-19 11:29:52.677 +02:00 [DBG] Connection id "0HN4G89FB5FOD" bad request data: "Invalid request line: 'GET /\x0D'"
Microsoft.AspNetCore.Server.Kestrel.Core.BadHttpRequestException: Invalid request line: 'GET /\x0D'
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpParser`1.ParseRequestLine(TRequestHandler handler, ReadOnlySpan`1 requestLine)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpParser`1.ParseRequestLine(TRequestHandler handler, SequenceReader`1& reader)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Http1Connection.TakeStartLine(SequenceReader`1& reader)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Http1Connection.ParseRequest(SequenceReader`1& reader)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Http1Connection.TryParseRequest(ReadResult result, Boolean& endConnection)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequestsAsync[TContext](IHttpApplication`1 application)
2024-06-19 11:29:52.679 +02:00 [DBG] Connection id "0HN4G89FB5FOD" disconnecting.
2024-06-19 11:29:52.680 +02:00 [DBG] Connection id "0HN4G89FB5FOD" stopped.
2024-06-19 11:29:52.680 +02:00 [DBG] Connection id "0HN4G89FB5FOD" sending FIN because: "The Socket transport's send loop completed gracefully."

Unfortunately, cleaning up the repository did not help and PU will not refill it. The manual process, on the other hand, works without any problems, but in the end has no effect on PU. Any ideas as to why we are failing here?

Many thanks in advance

The problem has, however, solved itself

1 Like