Drop release times for CNode #2419

pull sipa wants to merge 1 commits into bitcoin:master from sipa:noreltime changing 3 files +9 −23
  1. sipa commented at 11:58 PM on March 28, 2013: member

    It seems there were two mechanisms for assessing whether a CNode was still in use: a refcount and a release timestamp. The latter seems to have been there for a long time, as a safety mechanism.

    However, this timer also keeps CNode objects alive for far longer than necessary after disconnects, potentially opening up a DoS window.

    This commit removes the timestamp-based mechanism, and replaces it with an assert(nRefCount >= 0), to verify that the refcounting is indeed correctly working.

  2. BitcoinPullTester commented at 10:06 AM on March 30, 2013: none

    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/307465b04e408e67cca991cf11b8238a487ba01f for binaries and test log. This is an automated test script which runs test cases on each commit every time is updated. It, however, dies sometimes and fails to test properly, if you are waiting on a test, please check timestamps and if the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ and contact BlueMatt on freenode if something looks broken.

  3. sipa commented at 4:14 AM on March 31, 2013: member

    Rebased.

  4. laanwj commented at 11:13 AM on March 31, 2013: member

    ACK

    BTW maybe we could use RAII or even one of the boost reference counting pointers here, instead of explicit AddRef/Release, as that tends to be somewhat more robust.

  5. BitcoinPullTester commented at 3:54 AM on April 3, 2013: none

    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/670921ec410923fa70a38dd44fdfec157bc6f8ca for binaries and test log. This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ Contact BlueMatt on freenode if something looks broken.

  6. Drop release times for CNode
    It seems there were two mechanisms for assessing whether a CNode
    was still in use: a refcount and a release timestamp. The latter
    seems to have been there for a long time, as a safety mechanism.
    
    However, this timer also keeps CNode objects alive for far longer
    than necessary after disconnects, potentially opening up a DoS
    window.
    
    This commit removes the timestamp-based mechanism, and replaces
    it with an assert(nRefCount >= 0), to verify that the refcounting
    is indeed correctly working.
    cedaa71446
  7. sipa commented at 1:11 PM on April 4, 2013: member

    Rebased.

  8. gmaxwell commented at 3:39 PM on April 4, 2013: contributor

    ACK. This has survived several days of testing and abuse.

  9. BitcoinPullTester commented at 9:31 PM on April 6, 2013: none

    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/cedaa714462871213472019545b8e862dacdac91 for binaries and test log. This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ Contact BlueMatt on freenode if something looks broken.

  10. sipa commented at 9:31 PM on April 7, 2013: member

    I've been testing this with an extra commit that prints out vNodesDisconnected.size() at shutdown, and this seems to be always 0. That means that the refcounting is indeed working as intended: it doesn't go too low (tested by the assert), and not too high (as that would mean they linger in vNodesDisconnected until they reach 0).

  11. gavinandresen commented at 1:46 PM on April 8, 2013: contributor

    ACK

  12. sipa referenced this in commit b7b774d82f on Apr 8, 2013
  13. sipa merged this on Apr 8, 2013
  14. sipa closed this on Apr 8, 2013

  15. sipa deleted the branch on May 3, 2013
  16. laudney referenced this in commit ebb4810791 on Mar 19, 2014
  17. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-19 09:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me