Opened 8 years ago

Last modified 3 years ago

#4085 new defect

We discard up to one second's worth of accounting bytes when time moves backward?

Reported by: arma Owned by:
Priority: Low Milestone: Tor: unspecified
Component: Core Tor/Tor Version:
Severity: Normal Keywords: tor-relay time monotonic accounting
Cc: Actual Points:
Parent ID: Points: 3
Reviewer: Sponsor:

Description

In main.c's second_elapsed_callback() we do:

  if (accounting_is_enabled(options) && seconds_elapsed >= 0)
    accounting_add_bytes(bytes_read, bytes_written, seconds_elapsed);

So that means if our clock goes backwards, we don't count whatever bytes we spent towards whether we should hibernate.

Is that actually wise? Does this situation happen often enough to matter? This bandwidth accounting stuff is messy.

(Noticed while reading patch for #3630)

Child Tickets

Change History (9)

comment:1 Changed 8 years ago by nickm

Milestone: Tor: 0.2.3.x-finalTor: 0.2.4.x-final

Moving this into 0.2.4; I think this is actually not a big problem, since at the bottom of that function we set current_second=now, so we will throw away at most one second's worth of data. (assuming that the callback gets called about once per second, which libevent should guarantee on any reasonable OS in 2.0, and on basically every OS in 2.1)

comment:2 Changed 7 years ago by nickm

Keywords: tor-relay added

comment:3 Changed 7 years ago by nickm

Component: Tor RelayTor

comment:4 Changed 7 years ago by nickm

Milestone: Tor: 0.2.4.x-finalTor: 0.2.5.x-final

comment:5 Changed 6 years ago by nickm

Milestone: Tor: 0.2.5.x-finalTor: 0.2.???

comment:6 Changed 3 years ago by teor

Milestone: Tor: 0.2.???Tor: 0.3.???

Milestone renamed

comment:7 Changed 3 years ago by nickm

Keywords: tor-03-unspecified-201612 added
Milestone: Tor: 0.3.???Tor: unspecified

Finally admitting that 0.3.??? was a euphemism for Tor: unspecified all along.

comment:8 Changed 3 years ago by nickm

Keywords: tor-03-unspecified-201612 removed

Remove an old triaging keyword.

comment:9 Changed 3 years ago by nickm

Keywords: time monotonic accounting added
Points: 3
Severity: Normal
Summary: We don't count accounting bytes when time moves backward?We discard up to one second's worth of accounting bytes when time moves backward?
Note: See TracTickets for help on using tickets.