You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@trafficserver.apache.org by shinrich <gi...@git.apache.org> on 2016/05/11 23:31:57 UTC

[GitHub] trafficserver pull request: TS-4309: Simplify read/write loops to ...

GitHub user shinrich opened a pull request:

    https://github.com/apache/trafficserver/pull/629

    TS-4309: Simplify read/write loops to address upload/download speed p\u2026

    \u2026roblems.
    
    May also help with ASAN crash reported in TS-4424.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/shinrich/trafficserver ts-4309-2

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/trafficserver/pull/629.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #629
    
----
commit 17457ff579e50cad2bdcd23b1679fd0d407a925f
Author: Susan Hinrichs <sh...@ieee.org>
Date:   2016-05-11T23:29:02Z

    TS-4309: Simplify read/write loops to address upload/download speed problems.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] trafficserver pull request: TS-4309: Simplify read/write loops to ...

Posted by oknet <gi...@git.apache.org>.
Github user oknet commented on a diff in the pull request:

    https://github.com/apache/trafficserver/pull/629#discussion_r64986856
  
    --- Diff: iocore/net/SSLNetVConnection.cc ---
    @@ -193,131 +193,121 @@ ssl_read_from_net(SSLNetVConnection *sslvc, EThread *lthread, int64_t &ret)
     {
       NetState *s = &sslvc->read;
       MIOBufferAccessor &buf = s->vio.buffer;
    -  IOBufferBlock *b = buf.writer()->first_write_block();
       int event = SSL_READ_ERROR_NONE;
       int64_t bytes_read = 0;
    -  int64_t block_write_avail = 0;
       ssl_error_t sslErr = SSL_ERROR_NONE;
       int64_t nread = 0;
     
       bool trace = sslvc->getSSLTrace();
       Debug("ssl", "trace=%s", trace ? "TRUE" : "FALSE");
     
    -  for (bytes_read = 0; (b != 0) && (sslErr == SSL_ERROR_NONE); b = b->next.get()) {
    -    block_write_avail = b->write_avail();
    +  bytes_read = 0;
    +  while (sslErr == SSL_ERROR_NONE) {
    +    int64_t 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;
    +      }
    +    }
    --- End diff --
    
    I believe these code will read SSL data until meet EAGAIN. How to handle a SSL flood attack ? a fast socket keeps sending and keeps call SSLReadBuffer and add_block() there no chance to return to NetHandler::manNetEvent() to processing next NetVC.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] trafficserver pull request: TS-4309: Simplify read/write loops to ...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/trafficserver/pull/629


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] trafficserver pull request: TS-4309: Simplify read/write loops to ...

Posted by atsci <gi...@git.apache.org>.
Github user atsci commented on the pull request:

    https://github.com/apache/trafficserver/pull/629#issuecomment-218621761
  
    Linux (CentOS7) build finished successfully. Details on https://ci.trafficserver.apache.org/job/Github-Linux/20/
     



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] trafficserver pull request: TS-4309: Simplify read/write loops to ...

Posted by shinrich <gi...@git.apache.org>.
Github user shinrich commented on a diff in the pull request:

    https://github.com/apache/trafficserver/pull/629#discussion_r64992940
  
    --- Diff: iocore/net/SSLNetVConnection.cc ---
    @@ -193,131 +193,121 @@ ssl_read_from_net(SSLNetVConnection *sslvc, EThread *lthread, int64_t &ret)
     {
       NetState *s = &sslvc->read;
       MIOBufferAccessor &buf = s->vio.buffer;
    -  IOBufferBlock *b = buf.writer()->first_write_block();
       int event = SSL_READ_ERROR_NONE;
       int64_t bytes_read = 0;
    -  int64_t block_write_avail = 0;
       ssl_error_t sslErr = SSL_ERROR_NONE;
       int64_t nread = 0;
     
       bool trace = sslvc->getSSLTrace();
       Debug("ssl", "trace=%s", trace ? "TRUE" : "FALSE");
     
    -  for (bytes_read = 0; (b != 0) && (sslErr == SSL_ERROR_NONE); b = b->next.get()) {
    -    block_write_avail = b->write_avail();
    +  bytes_read = 0;
    +  while (sslErr == SSL_ERROR_NONE) {
    +    int64_t 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;
    +      }
    +    }
    --- End diff --
    
    Good point.  Looking at the non-ssl version, it is tracking a max to read.  We should do something similar in the ssl-case. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---