Repository: trafficserver Updated Branches: refs/heads/master bd7637772 -> 806015002
TS-3901: Leaking connections from HttpSessionManager. Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/a54b47c6 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/a54b47c6 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/a54b47c6 Branch: refs/heads/master Commit: a54b47c6af06f0ed7739a61d32381e1fd44fa03c Parents: 8427ff9 Author: shinrich <[email protected]> Authored: Mon Oct 5 12:44:12 2015 -0500 Committer: shinrich <[email protected]> Committed: Mon Oct 5 12:44:12 2015 -0500 ---------------------------------------------------------------------- proxy/hdrs/HTTP.cc | 4 ++-- proxy/http/HttpServerSession.h | 2 +- proxy/http/HttpSessionManager.cc | 10 +++++++++- proxy/http/HttpSessionManager.h | 4 ++++ 4 files changed, 16 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a54b47c6/proxy/hdrs/HTTP.cc ---------------------------------------------------------------------- diff --git a/proxy/hdrs/HTTP.cc b/proxy/hdrs/HTTP.cc index aa0040b..46bc135 100644 --- a/proxy/hdrs/HTTP.cc +++ b/proxy/hdrs/HTTP.cc @@ -1532,12 +1532,12 @@ HTTPHdr::_fill_target_cache() const m_port_in_header = 0 != url->port_get_raw(); m_host_mime = NULL; } else if (0 != (m_host_mime = const_cast<HTTPHdr *>(this)->get_host_port_values(0, &m_host_length, &port_ptr, 0))) { + m_port = 0; if (port_ptr) { - m_port = 0; for (; is_digit(*port_ptr); ++port_ptr) m_port = m_port * 10 + *port_ptr - '0'; - m_port_in_header = (0 != m_port); } + m_port_in_header = (0 != m_port); m_port = url_canonicalize_port(url->m_url_impl->m_url_type, m_port); } http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a54b47c6/proxy/http/HttpServerSession.h ---------------------------------------------------------------------- diff --git a/proxy/http/HttpServerSession.h b/proxy/http/HttpServerSession.h index 3ec5f0c..8f57618 100644 --- a/proxy/http/HttpServerSession.h +++ b/proxy/http/HttpServerSession.h @@ -108,7 +108,7 @@ public: void release(); void attach_hostname(const char *hostname); NetVConnection * - get_netvc() + get_netvc() const { return server_vc; }; http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a54b47c6/proxy/http/HttpSessionManager.cc ---------------------------------------------------------------------- diff --git a/proxy/http/HttpSessionManager.cc b/proxy/http/HttpSessionManager.cc index 5527ebb..d0b66cc 100644 --- a/proxy/http/HttpSessionManager.cc +++ b/proxy/http/HttpSessionManager.cc @@ -204,7 +204,15 @@ ServerSessionPool::eventHandler(int event, void *data) if (!found) { // We failed to find our session. This can only be the result // of a programming flaw - Warning("Connection leak from http keep-alive system"); + UnixNetVConnection *unix_net_vc = dynamic_cast<UnixNetVConnection *>(net_vc); + char peer_ip[INET6_ADDRPORTSTRLEN]; + if (unix_net_vc) { + ats_ip_nptop(unix_net_vc->get_remote_addr(), peer_ip, sizeof(peer_ip)); + } else { + peer_ip[0] = '\0'; + } + Warning("Connection leak from http keep-alive system fd=%d closed=%d peer_ip_port=%s", unix_net_vc->con.fd, unix_net_vc->closed, + peer_ip); ink_assert(0); } return 0; http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a54b47c6/proxy/http/HttpSessionManager.h ---------------------------------------------------------------------- diff --git a/proxy/http/HttpSessionManager.h b/proxy/http/HttpSessionManager.h index 8d82756..4372240 100644 --- a/proxy/http/HttpSessionManager.h +++ b/proxy/http/HttpSessionManager.h @@ -83,6 +83,10 @@ protected: static Key key(Value const *value) { + // Might be better to just fetch the comparing address from the + // netvc. That is what the event_handler will be using to + // looking elements in the m_ip_pool + // return value->get_netvc()->get_remote_addr(); return &value->server_ip.sa; } static bool
