[trafficserver] 02/02: FD leaks when ep.start() failed or cancelled in acceptEvent or con.connect() failed
This is an automated email from the ASF dual-hosted git repository. zwoop pushed a commit to branch 7.1.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git commit a2131ea016bc6e3559f71615dabf4dff32e9571f Author: Oknet Xu AuthorDate: Wed Aug 30 18:32:24 2017 +0800 FD leaks when ep.start() failed or cancelled in acceptEvent or con.connect() failed (cherry picked from commit 9ded874c82de732d2c2d42c2b633d7e94adcb2e7) Conflicts: iocore/net/UnixNetVConnection.cc --- iocore/net/SSLNetVConnection.cc | 1 - iocore/net/UnixNetVConnection.cc | 8 +--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/iocore/net/SSLNetVConnection.cc b/iocore/net/SSLNetVConnection.cc index 53d7012..9b389a2 100644 --- a/iocore/net/SSLNetVConnection.cc +++ b/iocore/net/SSLNetVConnection.cc @@ -892,7 +892,6 @@ SSLNetVConnection::free(EThread *t) closed = 0; options.reset(); - con.close(); ink_assert(con.fd == NO_FD); diff --git a/iocore/net/UnixNetVConnection.cc b/iocore/net/UnixNetVConnection.cc index fc6967a..051fcec 100644 --- a/iocore/net/UnixNetVConnection.cc +++ b/iocore/net/UnixNetVConnection.cc @@ -94,7 +94,6 @@ close_UnixNetVConnection(UnixNetVConnection *vc, EThread *t) NetHandler *nh = vc->nh; vc->cancel_OOB(); vc->ep.stop(); - vc->con.close(); ink_release_assert(vc->thread == t); @@ -1154,14 +1153,14 @@ UnixNetVConnection::acceptEvent(int event, Event *e) SET_HANDLER((NetVConnHandler)&UnixNetVConnection::mainEvent); - nh = get_NetHandler(thread); PollDescriptor *pd = get_PollDescriptor(thread); if (ep.start(pd, this, EVENTIO_READ | EVENTIO_WRITE) < 0) { Debug("iocore_net", "acceptEvent : failed EventIO::start"); -close_UnixNetVConnection(this, e->ethread); +free(t); return EVENT_DONE; } + nh = get_NetHandler(thread); set_inactivity_timeout(0); nh->open_list.enqueue(this); @@ -1396,6 +1395,9 @@ void UnixNetVConnection::free(EThread *t) { ink_release_assert(t == this_ethread()); + + // close socket fd + con.close(); // clear variables for reuse this->mutex.clear(); action_.mutex.clear(); -- To stop receiving notification emails like this one, please contact "commits@trafficserver.apache.org" .
[trafficserver] 02/02: FD leaks when ep.start() failed or cancelled in acceptEvent or con.connect() failed
This is an automated email from the ASF dual-hosted git repository. zwoop pushed a commit to branch 7.1.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git commit 319e219f6b98f331e6cd0e6ee302da770a150213 Author: Oknet Xu AuthorDate: Wed Aug 30 18:32:24 2017 +0800 FD leaks when ep.start() failed or cancelled in acceptEvent or con.connect() failed (cherry picked from commit 9ded874c82de732d2c2d42c2b633d7e94adcb2e7) Conflicts: iocore/net/UnixNetVConnection.cc --- iocore/net/SSLNetVConnection.cc | 1 - iocore/net/UnixNetVConnection.cc | 8 +--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/iocore/net/SSLNetVConnection.cc b/iocore/net/SSLNetVConnection.cc index 53d7012..9b389a2 100644 --- a/iocore/net/SSLNetVConnection.cc +++ b/iocore/net/SSLNetVConnection.cc @@ -892,7 +892,6 @@ SSLNetVConnection::free(EThread *t) closed = 0; options.reset(); - con.close(); ink_assert(con.fd == NO_FD); diff --git a/iocore/net/UnixNetVConnection.cc b/iocore/net/UnixNetVConnection.cc index c914f6c..122cd42 100644 --- a/iocore/net/UnixNetVConnection.cc +++ b/iocore/net/UnixNetVConnection.cc @@ -94,7 +94,6 @@ close_UnixNetVConnection(UnixNetVConnection *vc, EThread *t) NetHandler *nh = vc->nh; vc->cancel_OOB(); vc->ep.stop(); - vc->con.close(); ink_release_assert(vc->thread == t); @@ -1152,14 +1151,14 @@ UnixNetVConnection::acceptEvent(int event, Event *e) SET_HANDLER((NetVConnHandler)&UnixNetVConnection::mainEvent); - nh = get_NetHandler(thread); PollDescriptor *pd = get_PollDescriptor(thread); if (ep.start(pd, this, EVENTIO_READ | EVENTIO_WRITE) < 0) { Debug("iocore_net", "acceptEvent : failed EventIO::start"); -close_UnixNetVConnection(this, e->ethread); +free(t); return EVENT_DONE; } + nh = get_NetHandler(thread); set_inactivity_timeout(0); nh->open_list.enqueue(this); @@ -1394,6 +1393,9 @@ void UnixNetVConnection::free(EThread *t) { ink_release_assert(t == this_ethread()); + + // close socket fd + con.close(); // clear variables for reuse this->mutex.clear(); action_.mutex.clear(); -- To stop receiving notification emails like this one, please contact "commits@trafficserver.apache.org" .