Discussion:
[tor-relays] [Relay] Hibernation Reset
Tor Operator
2015-07-20 17:12:10 UTC
Permalink
Hi gents,

I rencetly had one of my relay fall into hibernation. It seems that
simply restarting the service doesn't change the hibernation status
since Tor is still thinking that the BW limits have been overrun. Is the
proper method to reset the status of the node is simply to delete the
"state" file in "/var/lib/tor/". For now, I just set back to 0 the
"AccountingBytesReadInInterval" and "AccountingBytesWrittenInInterval"
counters and the node was able to wake up but that doesn't seem like a
very elegant way to do it.

Thanks,
teor
2015-07-21 15:09:34 UTC
Permalink
Post by Tor Operator
Hi gents,
I rencetly had one of my relay fall into hibernation. It seems that simply restarting the service doesn't change the hibernation status since Tor is still thinking that the BW limits have been overrun. Is the proper method to reset the status of the node is simply to delete the "state" file in "/var/lib/tor/". For now, I just set back to 0 the "AccountingBytesReadInInterval" and "AccountingBytesWrittenInInterval" counters and the node was able to wake up but that doesn't seem like a very elegant way to do it.
Why not edit or remove the accounting limits in the torrc?
We might need a little more context: why are the accounting limits set lower than you want?
What exactly are you trying to achieve?

Tim

Tim Wilson-Brown (teor)

teor2345 at gmail dot com
pgp ABFED1AC
https://gist.github.com/teor2345/d033b8ce0a99adbc89c5

teor at blah dot im
OTR D5BE4EC2 255D7585 F3874930 DB130265 7C9EBBC7
Tor Operator
2015-07-22 05:30:14 UTC
Permalink
Here goes.

The relay was configured to turn off when 1TB of traffic was reached. It
did so way faster than I anticipated. Moreover, my VPS host actually
doesn't count inbound traffic as part of my monthly limit. Since a TOR
relay traffic is mostly symmetric, it does mean that BWAccounting will
still consider the inbound traffic as part of the hard-limit.

The old configuration was :
AccountingRule sum
AccountingMax 1000 GBytes

That was obviously a mistake since the "sum" method meant that I would
hit the hard-limit really quickly. Here is the current configuration
that I'm testing. What I want is simply to reset the accounting cycle on
the first of every month. The max statement should allow me to use
1.5TB~ of data (750 GB inbound / 750 GB outbound) :

AccountingRule max
AccountingStart month 1 00:00
AccountingMax 750 GBytes

Now, since accounting also tracks the "old" data, is there a way to
"start anew"? To reset the data accumulated so far?

I appreciate any help on the matter!

Thanks.
Post by teor
Post by Tor Operator
Hi gents,
I rencetly had one of my relay fall into hibernation. It seems that
simply restarting the service doesn't change the hibernation status
since Tor is still thinking that the BW limits have been overrun. Is
the proper method to reset the status of the node is simply to delete
the "state" file in "/var/lib/tor/". For now, I just set back to 0
the "AccountingBytesReadInInterval" and
"AccountingBytesWrittenInInterval" counters and the node was able to
wake up but that doesn't seem like a very elegant way to do it.
Why not edit or remove the accounting limits in the torrc?
We might need a little more context: why are the accounting limits set lower than you want?
What exactly are you trying to achieve?
Tim
Tim Wilson-Brown (teor)
teor2345 at gmail dot com
pgp ABFED1AC
https://gist.github.com/teor2345/d033b8ce0a99adbc89c5
teor at blah dot im
OTR D5BE4EC2 255D7585 F3874930 DB130265 7C9EBBC7
_______________________________________________
tor-relays mailing list
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-relays
teor
2015-07-22 09:30:03 UTC
Permalink
Post by Tor Operator
Post by teor
Post by Tor Operator
Hi gents,
I rencetly had one of my relay fall into hibernation. It seems that simply restarting the service doesn't change the hibernation status since Tor is still thinking that the BW limits have been overrun. Is the proper method to reset the status of the node is simply to delete the "state" file in "/var/lib/tor/". For now, I just set back to 0 the "AccountingBytesReadInInterval" and "AccountingBytesWrittenInInterval" counters and the node was able to wake up but that doesn't seem like a very elegant way to do it.
Why not edit or remove the accounting limits in the torrc?
We might need a little more context: why are the accounting limits set lower than you want?
What exactly are you trying to achieve?
Here goes.
The relay was configured to turn off when 1TB of traffic was reached. It did so way faster than I anticipated. Moreover, my VPS host actually doesn't count inbound traffic as part of my monthly limit. Since a TOR relay traffic is mostly symmetric, it does mean that BWAccounting will still consider the inbound traffic as part of the hard-limit.
We have a ticket logged to add accounting rules "in" and "out", but no-one has submitted a patch yet.

#15989 (Add AccountingRule in and out)
https://trac.torproject.org/projects/tor/ticket/15989
Post by Tor Operator
AccountingRule sum
AccountingMax 1000 GBytes
AccountingRule max
AccountingStart month 1 00:00
AccountingMax 750 GBytes
Now, since accounting also tracks the "old" data, is there a way to "start anew"? To reset the data accumulated so far?
Recent versions of Tor record the "in" and "out" amounts in the state file, then calculate the "sum" or "max" when applying the rule. Are you using a version which doesn't do this?

I have in my state file:
AccountingBytesReadInInterval 1…
AccountingBytesWrittenInInterval 1…

But you're right, we also need a way of resetting the bandwidth once. Adding command-line arguments such as AccountingSetRead/Written would seem to be the way to go.
I've added a ticket for this:
https://trac.torproject.org/projects/tor/ticket/16636

For the moment, there are two workarounds:
* Set the reset time for 2 minutes time, send a HUP to Tor, let it reset, then set the reset for the first of the month, and send another HUP
* Stop Tor, edit the state file manually, and remove all the "Accounting" lines, and start Tor

Tim

Tim Wilson-Brown (teor)

teor2345 at gmail dot com
pgp ABFED1AC
https://gist.github.com/teor2345/d033b8ce0a99adbc89c5

teor at blah dot im
OTR D5BE4EC2 255D7585 F3874930 DB130265 7C9EBBC7

Loading...