rpc: pass errors from async_accept and avoid leaks #4142

pull laanwj wants to merge 4 commits into bitcoin:master from laanwj:2014_05_rpcserver changing 2 files +23 −17
  1. laanwj commented at 8:04 AM on May 7, 2014: member

    Some commits to (hopefully) improve RPC behaviour:

    • Pass errors from async_accept
    • Make sure connection object is always cleaned up See individual commit messages for details.
    • Make sure that acceptors and timers are cancelled before exiting the event loops.
  2. laanwj added this to the milestone 0.9.2 on May 9, 2014
  3. laanwj added the label RPC on May 9, 2014
  4. rpc: pass errors from async_accept
    According to the [boost::asio documentation](http://www.boost.org/doc/libs/1_55_0/doc/html/boost_asio/reference/basic_socket_acceptor/async_accept/overload2.html),
    the function signature of the handler must be:
    
        void handler(
          const boost::system::error_code& error // Result of operation.
        );
    
    We were binding *all* the arguments, instead of all but the error,
    resulting in nullary function that never got the error. Fix this
    by adding an input argument substitution.
    0a0cd34552
  5. rpc: Make sure conn object is always cleaned up
    Make sure conn object always gets cleaned up by using a
    `boost::shared_ptr`.
    
    This makes valgrind happy - before this commit, one connection object
    always leaked at shutdown, as well as can avoid other leaks, when
    for example an exception happens.
    
    Also add an explicit Close() to the !ClientAllowed path to make it similar
    to the normal path (I'm not sure whether it is needed, but it
    can't hurt).
    1a445225f6
  6. doc: remove mention of `-rpctimeout` from man page
    That option hasn't existed for a long time.
    381b25dfde
  7. rpc: keep track of acceptors, and cancel them in StopRPCThreads
    Fixes #4156.
    
    The problem is that the boost::asio::io_service destructor
    waits for the acceptors to finish (on windows, and boost 1.55).
    
    Fix this by keeping track of the acceptors and cancelling them before
    stopping the event loops.
    cef44941e7
  8. BitcoinPullTester commented at 8:23 AM on May 12, 2014: none

    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/cef44941e798c33f7334bf90a2dd531f9bada8c3 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.

  9. laanwj merged this on May 12, 2014
  10. laanwj closed this on May 12, 2014

  11. laanwj referenced this in commit 53d9709e1c on May 12, 2014
  12. 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-13 15:15 UTC

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