From 7837334361e95fcc4a3dcb7d40f00f07ee7d0e4c Mon Sep 17 00:00:00 2001 From: imterah Date: Wed, 8 Jan 2025 11:40:42 -0500 Subject: [PATCH] fix: Fixes various crashes. --- backend/api/backendruntime/runtime.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/backend/api/backendruntime/runtime.go b/backend/api/backendruntime/runtime.go index 1e79406..a65c077 100644 --- a/backend/api/backendruntime/runtime.go +++ b/backend/api/backendruntime/runtime.go @@ -421,7 +421,12 @@ SchedulingLoop: } // Fetch response and close Channel - response := <-commandChannel + response, ok := <-commandChannel + + if !ok { + return nil, fmt.Errorf("failed to read from command channel: recieved signal that is not OK") + } + close(commandChannel) err, ok := response.(error) @@ -443,11 +448,11 @@ func (runtime *Runtime) cleanUpPendingCommandProcessingJobs() { select { case <-timeoutChannel: - log.Fatal("Message channel is likely running (timed out reading from it without an error)") + log.Warn("Message channel is likely running (timed out reading from it without an error)") close(message.Channel) case _, ok := <-message.Channel: if ok { - log.Fatal("Message channel is running, but should be stopped (since message is NOT nil!)") + log.Warn("Message channel is running, but should be stopped (since message is NOT nil!)") close(message.Channel) } }