Fix Errno::ECONNRESET error for Tubesock

* We must not close the socket manually (with `client_socket.close`), as this would close it twice. Compare: 2c83794b85/lib/tubesock.rb (L92)
* When the socket is closed twice, nginx registers a `Connection reset by peer` error: `recv() failed (104: Connection reset by peer) while proxying upgraded connection`
* Tubesock automatically closes the socket when the `hijack` block ends and otherwise ignores `Errno::ECONNRESET`: 2c83794b85/lib/tubesock.rb (L161-L162)
This commit is contained in:
Sebastian Serth
2023-08-22 00:20:02 +02:00
parent 2f0cf615d0
commit 269f135812

View File

@ -313,7 +313,9 @@ class SubmissionsController < ApplicationController
# We don't want to store this (arbitrary) exit command and redirect it ourselves
client_socket.send_data JSON.dump({cmd: :exit})
client_socket.send_data nil, :close
client_socket.close
# We must not close the socket manually (with `client_socket.close`), as this would close it twice.
# When the socket is closed twice, nginx registers a `Connection reset by peer` error.
# Tubesock automatically closes the socket when the `hijack` block ends and otherwise ignores `Errno::ECONNRESET`.
end
def create_remote_evaluation_mapping