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

zwoop 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 9ded874  FD leaks when ep.start() failed or cancelled in acceptEvent 
or con.connect() failed
9ded874 is described below

commit 9ded874c82de732d2c2d42c2b633d7e94adcb2e7
Author: Oknet Xu <xuc...@skyguard.com.cn>
AuthorDate: Wed Aug 30 18:32:24 2017 +0800

    FD leaks when ep.start() failed or cancelled in acceptEvent or 
con.connect() failed
---
 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 9d0ac5e..252b0c7 100644
--- a/iocore/net/SSLNetVConnection.cc
+++ b/iocore/net/SSLNetVConnection.cc
@@ -878,7 +878,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 25e1582..8ed2eb0 100644
--- a/iocore/net/UnixNetVConnection.cc
+++ b/iocore/net/UnixNetVConnection.cc
@@ -84,7 +84,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);
 
@@ -1141,14 +1140,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, t);
+    free(t);
     return EVENT_DONE;
   }
 
+  nh = get_NetHandler(thread);
   set_inactivity_timeout(0);
   nh->open_list.enqueue(this);
 
@@ -1372,6 +1371,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" <commits@trafficserver.apache.org>'].

Reply via email to