Fix memleak in TorController #7610

pull jonasschnelli wants to merge 1 commits into bitcoin:master from jonasschnelli:2016/02/torctrl_memleak changing 1 files +8 −0
  1. jonasschnelli commented at 7:52 PM on February 26, 2016: contributor

    It looks like, TorController::disconnected_cb(TorControlConnection& conn) gets called multiple times which results in multiple event_new().

    Needs testing!

    2016-02-26 19:29:42 setKeyPool.size() = 101
    2016-02-26 19:29:42 mapWallet.size() = 2202
    2016-02-26 19:29:42 mapAddressBook.size() = 4
    2016-02-26 19:29:42 init message: Loading addresses...
    2016-02-26 19:29:42 torcontrol thread start
    2016-02-26 19:29:42 tor: Error connecting to Tor control socket
    2016-02-26 19:29:42 tor: Not connected to Tor control port 127.0.0.1:9051, trying to reconnect
    2016-02-26 19:29:43 Loaded 0 addresses from peers.dat  1732ms
    2016-02-26 19:29:43 tor: Error connecting to Tor control socket
    2016-02-26 19:29:43 tor: Not connected to Tor control port 127.0.0.1:9051, trying to reconnect
    2016-02-26 19:29:43 init message: Loading banlist...
    2016-02-26 19:29:45 tor: Error connecting to Tor control socket
    2016-02-26 19:29:45 tor: Not connected to Tor control port 127.0.0.1:9051, trying to reconnect
    2016-02-26 19:29:46 dnsseed thread start
    2016-02-26 19:29:46 net thread start
    
  2. Fix memleak in TorController a9028b5df6
  3. jonasschnelli added the label Needs backport on Feb 26, 2016
  4. laanwj commented at 8:17 AM on February 29, 2016: member

    utACK nit: event_free implies event_del, doing both is unnecessary

  5. theuni commented at 5:13 PM on March 1, 2016: member

    Why free/create every time the event is set? They're reusable. How about just event_new in the ctor, event_free in the dtor, and event_add as needed?

    Edit: The naming may be confusing to those unfamiliar with libevent. event_new allocates, event_add schedules a new event, event_del un-schedules if not yet run, event_free deallocates. I suggest just making it RAII-like.

  6. laanwj commented at 5:30 PM on March 1, 2016: member

    Good point @theuni!

  7. laanwj referenced this in commit fb5b875321 on Mar 3, 2016
  8. laanwj referenced this in commit e219503711 on Mar 3, 2016
  9. laanwj commented at 12:31 PM on March 3, 2016: member

    Closing in favor of #7637

  10. laanwj closed this on Mar 3, 2016

  11. MarcoFalke added the label P2P on Apr 25, 2016
  12. MarcoFalke added the label Resource usage on Apr 25, 2016
  13. MarcoFalke removed the label Needs backport on Apr 25, 2016
  14. MarcoFalke commented at 1:23 PM on April 25, 2016: member

    Removing label 'needs backport'

  15. MarcoFalke referenced this in commit 4eb70a1816 on Apr 25, 2016
  16. MarcoFalke referenced this in commit 66d5408559 on Apr 27, 2016
  17. makevoid referenced this in commit cda7fc4339 on Jun 13, 2016
  18. thokon00 referenced this in commit da87b1ca6a on Jun 28, 2016
  19. sickpig referenced this in commit 1a43fa56ae on Nov 14, 2016
  20. MarcoFalke 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 21:15 UTC

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