This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new 8dba44a  Fix bad HTTP/2 post client causing stuck HttpSM (#7237)
8dba44a is described below

commit 8dba44a243ca3593663cca3ef96624adefcb37b3
Author: Susan Hinrichs <shinr...@yahoo-inc.com>
AuthorDate: Fri Oct 16 08:20:39 2020 -0500

    Fix bad HTTP/2 post client causing stuck HttpSM (#7237)
    
    (cherry picked from commit 786463b24a26704b4429725b9f0b3787ba812270)
---
 proxy/http/HttpSM.cc     | 6 +++---
 proxy/http/HttpTunnel.cc | 4 ++++
 proxy/http/HttpTunnel.h  | 2 +-
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index 4313bb3..068678d 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -2687,7 +2687,7 @@ HttpSM::tunnel_handler_post_or_put(HttpTunnelProducer *p)
     tunnel.reset();
     // When the ua completed sending it's data we must have
     //  removed it from the tunnel
-    ink_release_assert(ua_entry->in_tunnel == false);
+    ua_entry->in_tunnel     = false;
     server_entry->in_tunnel = false;
 
     break;
@@ -3635,7 +3635,7 @@ HttpSM::tunnel_handler_post_server(int event, 
HttpTunnelConsumer *c)
     // do not shut down the client read
     if (enable_redirection) {
       if (ua_producer->vc_type == HT_STATIC && event != VC_EVENT_ERROR && 
event != VC_EVENT_EOS) {
-        ua_entry->read_vio = ua_producer->vc->do_io_read(this, INT64_MAX, 
c->producer->read_buffer);
+        ua_entry->read_vio = ua_producer->vc->do_io_read(this, INT64_MAX, 
ua_buffer_reader->mbuf);
         // ua_producer->vc->do_io_shutdown(IO_SHUTDOWN_READ);
         t_state.client_info.pipeline_possible = false;
       } else {
@@ -3644,7 +3644,7 @@ HttpSM::tunnel_handler_post_server(int event, 
HttpTunnelConsumer *c)
         }
       }
     } else {
-      ua_entry->read_vio = ua_producer->vc->do_io_read(this, INT64_MAX, 
c->producer->read_buffer);
+      ua_entry->read_vio = ua_producer->vc->do_io_read(this, INT64_MAX, 
ua_buffer_reader->mbuf);
       // we should not shutdown read side of the client here to prevent 
sending a reset
       // ua_producer->vc->do_io_shutdown(IO_SHUTDOWN_READ);
       t_state.client_info.pipeline_possible = false;
diff --git a/proxy/http/HttpTunnel.cc b/proxy/http/HttpTunnel.cc
index 0588acd..0dc0fb2 100644
--- a/proxy/http/HttpTunnel.cc
+++ b/proxy/http/HttpTunnel.cc
@@ -1332,6 +1332,9 @@ HttpTunnel::consumer_handler(int event, 
HttpTunnelConsumer *c)
     if (c->producer && c->producer->handler_state == 0) {
       if (event == VC_EVENT_WRITE_COMPLETE) {
         c->producer->handler_state = HTTP_SM_POST_SUCCESS;
+        // If the consumer completed, presumably the producer successfully 
read and is done
+        c->producer->read_success = true;
+        c->producer->alive        = false;
       } else if (c->vc_type == HT_HTTP_SERVER) {
         c->producer->handler_state = HTTP_SM_POST_UA_FAIL;
       } else if (c->vc_type == HT_HTTP_CLIENT) {
@@ -1614,6 +1617,7 @@ HttpTunnel::main_handler(int event, void *data)
       ink_assert(c->write_vio == (VIO *)data || c->vc == ((VIO 
*)data)->vc_server);
       sm_callback = consumer_handler(event, c);
     } else {
+      // Presumably a delayed event we can ignore now
       internal_error(); // do nothing
     }
   }
diff --git a/proxy/http/HttpTunnel.h b/proxy/http/HttpTunnel.h
index 9ba0f97..c6aa9fc 100644
--- a/proxy/http/HttpTunnel.h
+++ b/proxy/http/HttpTunnel.h
@@ -483,7 +483,7 @@ HttpTunnel::get_consumer(VIO *vio)
 {
   if (vio) {
     for (int i = 0; i < MAX_CONSUMERS; i++) {
-      if (consumers[i].alive && (consumers[i].write_vio == vio || 
consumers[i].vc == vio->vc_server)) {
+      if (consumers[i].alive && consumers[i].write_vio == vio) {
         return consumers + i;
       }
     }

Reply via email to