]> xenbits.xensource.com Git - osstest.git/commitdiff
TCP fix: Do not wait for ownerdaemon to speak
authorIan Jackson <ian.jackson@eu.citrix.com>
Mon, 28 Sep 2020 11:43:30 +0000 (12:43 +0100)
committerIan Jackson <ian.jackson@eu.citrix.com>
Mon, 28 Sep 2020 12:13:09 +0000 (13:13 +0100)
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
tcl/JobDB-Executive.tcl

index 29c82821d4d6a4bf7eb475966033e781286b1e6e..4fe8569655a3f843bf09bf1915ac5340d8948868 100644 (file)
@@ -414,7 +414,20 @@ proc become-task {comment} {
 
     set ownerqueue [socket $c(OwnerDaemonHost) $c(OwnerDaemonPort)]
     fconfigure $ownerqueue -buffering line -translation lf
+
+    # TCP connections can get into a weird state where the client
+    # thinks the connection is open but the server has no record
+    # of it.  To avoid this, have the client speak without waiting
+    # for the server.  We tolerate "unknown command" errors so
+    # that it is not necessary to restart the ownerdaemon since
+    # that is very disruptive.
+    #
+    # See A TCP "stuck" connection mystery"
+    # https://www.evanjones.ca/tcp-stuck-connection-mystery.html
+    puts $ownerqueue noop
     must-gets $ownerqueue {^OK ms-ownerdaemon\M}
+    must-gets $ownerqueue {^OK noop|^ERROR unknown command}
+
     puts $ownerqueue create-task
     must-gets $ownerqueue {^OK created-task (\d+) (\w+ [\[\]:.0-9a-f]+)$} \
         taskid refinfo