Oknet Xu created TS-4804:
----------------------------

             Summary: 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


{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)

Reply via email to