You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficserver.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2016/09/01 12:14:20 UTC

[jira] [Work logged] (TS-4804) Incorrect write.vio.ndone

     [ https://issues.apache.org/jira/browse/TS-4804?focusedWorklogId=27718&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-27718 ]

ASF GitHub Bot logged work on TS-4804:
--------------------------------------

                Author: ASF GitHub Bot
            Created on: 01/Sep/16 12:13
            Start Date: 01/Sep/16 12:13
    Worklog Time Spent: 10m 
      Work Description: GitHub user oknet opened a pull request:

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

    TS-4804: Add r into total_written only if r > 0

    

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

    $ git pull https://github.com/oknet/trafficserver TS-4804

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

    https://github.com/apache/trafficserver/pull/952.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 #952
    
----
commit bf7229004151d48a8313f962f94f3c7b659aae2e
Author: Oknet Xu <xu...@skyguard.com.cn>
Date:   2016-09-01T12:12:05Z

    TS-4804: Add r into total_written only if r > 0

----


Issue Time Tracking
-------------------

            Worklog Id:     (was: 27718)
            Time Spent: 10m
    Remaining Estimate: 0h

> Incorrect write.vio.ndone
> -------------------------
>
>                 Key: TS-4804
>                 URL: https://issues.apache.org/jira/browse/TS-4804
>             Project: Traffic Server
>          Issue Type: Bug
>          Components: Core
>            Reporter: Oknet Xu
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> {code}
> int64_t
> UnixNetVConnection::load_buffer_and_write(int64_t towrite, MIOBufferAccessor &buf, int64_t &total_written, int &needs)
> {
> ...
>     if (r > 0) {
>       buf.reader()->consume(r);
>     }
>     total_written += r;
> ...
>   return r;
> }
> {code}
> the 'r' is returned from socketManage.writev().
> 'total_written += r;' should be enclosed by if statement because the 'r' may be a negative value otherwise the total_written is incorrect.
> {code}
> void
> write_to_net_io(NetHandler *nh, UnixNetVConnection *vc, EThread *thread)
> {
> ...
>   int64_t r             = vc->load_buffer_and_write(towrite, buf, total_written, needs);
>   if (total_written > 0) {
>     NET_SUM_DYN_STAT(net_write_bytes_stat, total_written);
>     s->vio.ndone += total_written;
>   }
> ...
> }
> {code}
> The incorrect total_written will cause the incorrect of write.vio.ndone.



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