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

shinrich pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new 784ba43  Expanding the cases where the server_entry gets cleared on 
error.
784ba43 is described below

commit 784ba4383db72892ba794a7b83904af370b6f35a
Author: Susan Hinrichs <shinr...@apache.org>
AuthorDate: Tue Jan 23 08:57:54 2018 -0600

    Expanding the cases where the server_entry gets cleared on error.
---
 proxy/http/HttpSM.cc       | 18 +++++++++++-------
 proxy/http/HttpTransact.cc |  7 +++----
 2 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index 3a96156..fded2c2 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -5433,14 +5433,16 @@ HttpSM::handle_server_setup_error(int event, void *data)
         ua_producer->alive         = false;
         ua_producer->handler_state = HTTP_SM_POST_SERVER_FAIL;
         tunnel.handleEvent(VC_EVENT_ERROR, c->write_vio);
+        return;
       }
     } else {
       // c could be null here as well
       if (c != nullptr) {
         tunnel.handleEvent(event, c->write_vio);
+        return;
       }
     }
-    return;
+    // If there is no consumer, let the event pass through to shutdown
   } else {
     if (post_transform_info.vc) {
       HttpTunnelConsumer *c = tunnel.get_consumer(post_transform_info.vc);
@@ -5477,15 +5479,17 @@ HttpSM::handle_server_setup_error(int event, void *data)
     // if (vio->op == VIO::WRITE && vio->ndone == 0) {
     if (server_entry->write_vio && server_entry->write_vio->nbytes > 0 && 
server_entry->write_vio->ndone == 0) {
       t_state.current.state = HttpTransact::CONNECTION_ERROR;
-      if (server_entry) {
-        ink_assert(server_entry->vc_type == HTTP_SERVER_VC);
-        vc_table.cleanup_entry(server_entry);
-        server_entry   = nullptr;
-        server_session = nullptr;
-      }
     } else {
       t_state.current.state = HttpTransact::INACTIVE_TIMEOUT;
     }
+    // Clean up the vc_table entry so any events in play to the timed out 
server vio
+    // don't get handled.  The connection isn't there.
+    if (server_entry) {
+      ink_assert(server_entry->vc_type == HTTP_SERVER_VC);
+      vc_table.cleanup_entry(server_entry);
+      server_entry   = nullptr;
+      server_session = nullptr;
+    }
     break;
   default:
     ink_release_assert(0);
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index 0c5ae6b..9867ca1 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -6275,10 +6275,9 @@ HttpTransact::is_request_retryable(State *s)
 {
   // If safe requests are  retryable, it should be safe to retry safe requests 
irrespective of bytes sent or connection state
   // according to RFC the following methods are safe 
(https://tools.ietf.org/html/rfc7231#section-4.2.1)
-  // If there was no error establishing the connection (and we sent bytes)-- 
we cannot retry
-  if (!HttpTransactHeaders::is_method_safe(s->method) &&
-      (s->current.state != CONNECTION_ERROR && 
s->state_machine->server_request_hdr_bytes > 0 &&
-       s->state_machine->get_server_session()->get_netvc()->outstanding() != 
s->state_machine->server_request_hdr_bytes)) {
+  // Otherwise, if there was no error establishing the connection (and we sent 
bytes)-- we cannot retry
+  if (!HttpTransactHeaders::is_method_safe(s->method) && s->current.state != 
CONNECTION_ERROR &&
+      s->state_machine->server_request_hdr_bytes > 0) {
     return false;
   }
 

-- 
To stop receiving notification emails like this one, please contact
shinr...@apache.org.

Reply via email to