[ 
https://issues.apache.org/jira/browse/TS-4309?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15307321#comment-15307321
 ] 

Oknet Xu commented on TS-4309:
------------------------------

{{buf.writer()->write_avail();}} will extended the iobufferblock chains if no 
space to save data
{{SSLReadBuffer}} is used to read and decrypt data, but only received a full 
{{SSL Data Record}} and then decrypt it.
And a {{SSL Data Record}} could very large and trigger READ many times.
{{SSLReadBuffer}} return {{WANT READ}} before received a full {{SSL Data 
Record}}.
{{SSLReadBuffer}} could return all data of {{SSL Data Record}} when decrypt it.
the rest data keeps in {{rBIO}} if {{SSLReadBuffer}} return a parts of data 
depend on the size of read buffer.
Due to the data already decrypted and saved in {{rBIO}}, {{bytes_read}} could 
bigger than {{toread}} if there has enough {{write_avail}} space to save more 
data in {{rBIO}}.

{code}
diff --git a/iocore/net/SSLNetVConnection.cc b/iocore/net/SSLNetVConnection.cc
index c6e0e5a..dbe082b 100644
--- a/iocore/net/SSLNetVConnection.cc
+++ b/iocore/net/SSLNetVConnection.cc
@@ -201,16 +201,12 @@ ssl_read_from_net(SSLNetVConnection *sslvc, EThread 
*lthread, int64_t &ret)
   bool trace = sslvc->getSSLTrace();
   Debug("ssl", "trace=%s", trace ? "TRUE" : "FALSE");
 
-  bytes_read = 0;
-  while (sslErr == SSL_ERROR_NONE) {
-    int64_t block_write_avail = buf.writer()->block_write_avail();
+  int64_t toread = buf.writer()->write_avail();
+
+  while (sslErr == SSL_ERROR_NONE && bytes_read < toread) {
+    block_write_avail = buf.writer()->block_write_avail();
     if (block_write_avail <= 0) {
-      buf.writer()->add_block();
-      block_write_avail = buf.writer()->block_write_avail();
-      if (block_write_avail <= 0) {
-        Warning("Cannot add new block");
-        break;
-      }
+      break;
     }
 
     Debug("ssl", "[SSL_NetVConnection::ssl_read_from_net] b->write_avail()=%" 
PRId64, block_write_avail);
{code}

> Reduced SSL upload/download speed after event loop change (TS-4260)
> -------------------------------------------------------------------
>
>                 Key: TS-4309
>                 URL: https://issues.apache.org/jira/browse/TS-4309
>             Project: Traffic Server
>          Issue Type: Bug
>          Components: Core
>            Reporter: Susan Hinrichs
>            Assignee: Susan Hinrichs
>             Fix For: 7.0.0
>
>
> With the Eventloop changes of TS-4260 there are fewer spurious event loop 
> kicks.  This reveals stalls during upload and download on a lightly loaded 
> system.  Tidying up the net read/write loops and reactivating a never 
> triggered signal fixed the problem.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to