ChugR commented on a change in pull request #1129:
URL: https://github.com/apache/qpid-dispatch/pull/1129#discussion_r615051274



##########
File path: src/adaptors/tcp_adaptor.c
##########
@@ -288,18 +338,87 @@ static int handle_incoming_impl(qdr_tcp_connection_t 
*conn, bool close_pending)
         qd_message_set_q2_unblocked_handler(msg, qdr_tcp_q2_unblocked_handler, 
conn_sp);
 
         conn->instream = qdr_link_deliver(conn->incoming, msg, 0, false, 0, 0, 
0, 0);
-        qd_log(tcp_adaptor->log_source, QD_LOG_DEBUG, 
"[C%"PRIu64"][L%"PRIu64"] Initiating message with %i bytes", conn->conn_id, 
conn->incoming_id, count);
+        qd_log(log, QD_LOG_DEBUG,
+               "[C%"PRIu64"][L%"PRIu64"][D%"PRIu64"] Initiating ingress stream 
message with %u bytes",
+               conn->conn_id, conn->incoming_id, conn->instream->delivery_id, 
length);
+        conn->incoming_started = true;
+
+        // Handle deferment of write side close.
+        sys_mutex_lock(conn->activation_lock);
+        if (conn->read_eos_seen && !conn->raw_closed_write) {
+            // to-raw-conn EOS was seen before the from-raw-conn instream 
delivery existed.

Review comment:
       Because if the instream creation is too slow then close the raw 
connection becomes WRITE_CLOSED, then the server sends the response and closes 
it's connection, the raw connection becomes READ_CLOSED, and DISCONNECTED and 
everything is discarded.
   All this happens while waiting for the instream to come up and get credit.
   By deferring the write-close until the instream comes up then any server 
response has a place to go before the raw connection gets closed.
   On a single router test this condition would show up after maybe 500 or 3000 
successful tries. It was hard to track down, easy to fix.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org
For additional commands, e-mail: dev-h...@qpid.apache.org

Reply via email to