From 50a4707f6531380bae966e8834d59a131e96ad71 Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Fri, 8 Sep 2023 00:16:12 +0200 Subject: [PATCH] Prevent duplicated WebSocket close for client_kill Our investigation in CODEOCEAN-TV showed that we might attempt to close the WebSocket connection twice, if learners press the stop button. With this commit, we fix that issue. --- app/controllers/submissions_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/submissions_controller.rb b/app/controllers/submissions_controller.rb index ba1f2ac5..508433a5 100644 --- a/app/controllers/submissions_controller.rb +++ b/app/controllers/submissions_controller.rb @@ -242,7 +242,7 @@ class SubmissionsController < ApplicationController Sentry.capture_exception(e) extract_durations(e) ensure - close_client_connection(client_socket) + close_client_connection(client_socket) unless client_kill save_testrun_output 'run' Sentry.capture_message('Execution got terminated by client', extra: {websocket: @tubesock_debug_events, submission: @submission.id}) if @testrun[:status] == :terminated_by_client && !client_kill end