Updated Branches: refs/heads/3.3.x 5dec26764 -> cd64eddc4
TS-2051: Fix SSL crash due to excess READ_COMPLETE events. Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/84486681 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/84486681 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/84486681 Branch: refs/heads/3.3.x Commit: 84486681b865f9d3e5e8c79ffadc8f88834a33b2 Parents: c1c963e Author: Alan M. Carroll <a...@network-geographics.com> Authored: Tue Aug 6 15:09:05 2013 -0500 Committer: Alan M. Carroll <a...@network-geographics.com> Committed: Tue Aug 6 15:09:05 2013 -0500 ---------------------------------------------------------------------- CHANGES | 2 ++ iocore/net/SSLNetVConnection.cc | 18 +++++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/84486681/CHANGES ---------------------------------------------------------------------- diff --git a/CHANGES b/CHANGES index c358bb5..aed5f49 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,8 @@ -*- coding: utf-8 -*- Changes with Apache Traffic Server 3.3.5 + *) [TS-2051] Fix SSL crash due to excess READ_COMPLETE events. + *) [TS-2102] SPDY plugin tries to setup protocol handler too early. *) [TS-1953] remove version checks from plugins that don't use it and http://git-wip-us.apache.org/repos/asf/trafficserver/blob/84486681/iocore/net/SSLNetVConnection.cc ---------------------------------------------------------------------- diff --git a/iocore/net/SSLNetVConnection.cc b/iocore/net/SSLNetVConnection.cc index 3f429eb..86e788e 100644 --- a/iocore/net/SSLNetVConnection.cc +++ b/iocore/net/SSLNetVConnection.cc @@ -189,6 +189,7 @@ SSLNetVConnection::net_read_io(NetHandler *nh, EThread *lthread) int64_t bytes = 0; NetState *s = &this->read; MIOBufferAccessor &buf = s->vio.buffer; + int64_t ntodo = s->vio.ntodo(); MUTEX_TRY_LOCK_FOR(lock, s->vio.mutex, lthread, s->vio._cont); if (!lock) { @@ -228,21 +229,24 @@ SSLNetVConnection::net_read_io(NetHandler *nh, EThread *lthread) nh->write_ready_list.remove(this); writeReschedule(nh); } else if (ret == EVENT_DONE) { - read.triggered = 1; - if (read.enabled) - nh->read_ready_list.in_or_enqueue(this); + // If this was driven by a zero length read, signal complete when + // the handshake is complete. Otherwise set up for continuing read + // operations. + if (ntodo <= 0) { + readSignalDone(VC_EVENT_READ_COMPLETE, nh); + } else { + read.triggered = 1; + if (read.enabled) + nh->read_ready_list.in_or_enqueue(this); + } } else readReschedule(nh); return; } // If there is nothing to do, disable connection - int64_t ntodo = s->vio.ntodo(); if (ntodo <= 0) { read_disable(nh, this); - // Don't return early even if there's nothing. We still need - // to propagate events for zero-length reads. - readSignalDone(VC_EVENT_READ_COMPLETE, nh); return; }