Repository: trafficserver Updated Branches: refs/heads/master 74e2bb7be -> 3c8cb52d4
TS-3191: Add logic to better handle collisions between static producers. Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/3c8cb52d Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/3c8cb52d Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/3c8cb52d Branch: refs/heads/master Commit: 3c8cb52d450612b37915abc17c517675a6854ac8 Parents: 74e2bb7 Author: shinrich <[email protected]> Authored: Wed Nov 12 13:06:58 2014 -0600 Committer: Alan M. Carroll <[email protected]> Committed: Fri Nov 21 08:11:08 2014 -0600 ---------------------------------------------------------------------- CHANGES | 2 ++ proxy/http/HttpSM.cc | 15 +++++++++++++-- proxy/http/HttpTunnel.cc | 10 ++++++++-- 3 files changed, 23 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3c8cb52d/CHANGES ---------------------------------------------------------------------- diff --git a/CHANGES b/CHANGES index bdbc68b..d1c7e13 100644 --- a/CHANGES +++ b/CHANGES @@ -3,6 +3,8 @@ Changes with Apache Traffic Server 5.2.0 *) [TS-3074] Fix FreeBSD regression. + *) [TS-3191] Reduce confusion with HTTP_TUNNEL_STATIC_PRODUCER. + *) [TS-3065] Remove"Transfer-Encoding" header when the error body was set by ATS (e.g. plugin). Author: portl4t <[email protected]> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3c8cb52d/proxy/http/HttpSM.cc ---------------------------------------------------------------------- diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc index 47092c8..5f07f8c 100644 --- a/proxy/http/HttpSM.cc +++ b/proxy/http/HttpSM.cc @@ -3199,6 +3199,7 @@ HttpSM::tunnel_handler_ua(int event, HttpTunnelConsumer * c) // If the client could be pipelining or is doing a POST, we need to // set the ua_session into half close mode if ((t_state.method == HTTP_WKSIDX_POST || t_state.client_info.pipeline_possible == true) + && c->producer->vc_type != HT_STATIC && event == VC_EVENT_WRITE_COMPLETE) { ua_session->set_half_close_flag(); } @@ -3406,7 +3407,7 @@ HttpSM::tunnel_handler_post_ua(int event, HttpTunnelProducer * p) hsm_release_assert(ua_entry->in_tunnel == true); if (p->consumer_list.head->vc_type == HT_TRANSFORM) { hsm_release_assert(post_transform_info.entry->in_tunnel == true); - } else { + } else if (server_entry != NULL) { hsm_release_assert(server_entry->in_tunnel == true); } break; @@ -6048,6 +6049,11 @@ HttpSM::setup_internal_transfer(HttpSMHandler handler_arg) HTTP_SM_SET_DEFAULT_HANDLER(handler_arg); + // Clear the decks before we setup the new producers + // As things stand, we cannot have two static producers operating at + // once + tunnel.kill_tunnel(); + // Setup the tunnel to the client HttpTunnelProducer *p = tunnel.add_producer(HTTP_TUNNEL_STATIC_PRODUCER, nbytes, buf_start, (HttpProducerHandler) NULL, HT_STATIC, "internal msg"); @@ -6570,7 +6576,12 @@ HttpSM::kill_this() second_cache_sm->end_both(); transform_cache_sm.end_both(); vc_table.cleanup_all(); - tunnel.deallocate_buffers(); + + // tunnel.deallocate_buffers(); + // Why don't we just kill the tunnel? Might still be + // active if the state machine is going down hard, + // and we should clean it up. + tunnel.kill_tunnel(); // It possible that a plugin added transform hook // but the hook never executed due to a client abort http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3c8cb52d/proxy/http/HttpTunnel.cc ---------------------------------------------------------------------- diff --git a/proxy/http/HttpTunnel.cc b/proxy/http/HttpTunnel.cc index 1c8ffa7..4a76558 100644 --- a/proxy/http/HttpTunnel.cc +++ b/proxy/http/HttpTunnel.cc @@ -728,7 +728,8 @@ HttpTunnel::tunnel_run(HttpTunnelProducer * p_arg) for (int i = 0 ; i < MAX_PRODUCERS ; ++i) { p = producers + i; - if (p->vc != NULL) { + if (p->vc != NULL && + (p->alive || (p->vc_type == HT_STATIC && p->buffer_start != NULL))) { producer_run(p); } } @@ -1388,7 +1389,12 @@ HttpTunnel::chain_abort_all(HttpTunnelProducer * p) } if (c->self_producer) { - chain_abort_all(c->self_producer); + // Must snip the link before recursively + // freeing to avoid looks introduced by + // blind tunneling + HttpTunnelProducer *selfp = c->self_producer; + c->self_producer = NULL; + chain_abort_all(selfp); } c = c->link.next;
