net: initialize socket to avoid closing random fd's #12326

pull theuni wants to merge 1 commits into bitcoin:master from theuni:fix-socket-init changing 2 files +4 −1
  1. theuni commented at 3:33 PM on February 1, 2018: member

    An excellent spot by @david60.

    Even if it isn't causing the fd issue we're looking for, this should be fixed.

  2. in src/net.cpp:413 in 62e07f01e1 outdated
     409 | @@ -410,7 +410,7 @@ CNode* CConnman::ConnectNode(CAddress addrConnect, const char *pszDest, bool fCo
     410 |  
     411 |      // Connect
     412 |      bool connected = false;
     413 | -    SOCKET hSocket;
     414 | +    SOCKET hSocket = INVALID_SOCKET;
    


    Sjors commented at 3:37 PM on February 1, 2018:

    Why didn't a linter catch this uninitialized variable?

  3. MarcoFalke added this to the milestone 0.16.0 on Feb 1, 2018
  4. sdaftuar commented at 4:22 PM on February 1, 2018: member

    utACK

  5. promag commented at 4:26 PM on February 1, 2018: member

    utACK 62e07f0.

  6. net: initialize socket to avoid closing random fd's 96dbd381cf
  7. theuni force-pushed on Feb 1, 2018
  8. Sjors commented at 4:34 PM on February 1, 2018: member

    I'm currently running git bisect to figure out where the crashes started. Once that's done I'll also check if this commit makes them go away.

  9. laanwj commented at 5:41 PM on February 1, 2018: member

    utACK https://github.com/bitcoin/bitcoin/pull/12326/commits/96dbd381cf0ded169406bab3b1ba911a13d563c5 - this is obviously correct. Hope it solves the issue too.

  10. laanwj added the label Backport on Feb 1, 2018
  11. laanwj added the label P2P on Feb 1, 2018
  12. laanwj added the label Needs backport on Feb 1, 2018
  13. laanwj removed the label Backport on Feb 1, 2018
  14. laanwj referenced this in commit e54c1ac110 on Feb 1, 2018
  15. laanwj merged this on Feb 1, 2018
  16. laanwj closed this on Feb 1, 2018

  17. laanwj referenced this in commit 84291d18dd on Feb 1, 2018
  18. laanwj removed the label Needs backport on Feb 1, 2018
  19. Sjors cross-referenced this on Feb 1, 2018 from issue Consistent crashes for v0.16.0rc1 by Sjors
  20. laanwj cross-referenced this on Feb 2, 2018 from issue File descriptor problem, causing leveldb crash by laanwj
  21. dgenr8 cross-referenced this on Feb 6, 2018 from issue net: initialize socket to avoid closing random fd's by dgenr8
  22. HashUnlimited referenced this in commit 1cb1906bca on Mar 16, 2018
  23. practicalswift cross-referenced this on Sep 16, 2018 from issue net: Avoid using the value of a potentially invalid pointer (hSocket after close) by practicalswift
  24. lyricidal referenced this in commit dd3bc8bebd on Nov 17, 2019
  25. lyricidal cross-referenced this on Nov 17, 2019 from issue DAPS-1248 from Bitcoin: net: initialize socket to avoid closing random fd's by lyricidal
  26. lyricidal referenced this in commit 0ffa71a5f9 on Nov 24, 2019
  27. lyricidal referenced this in commit fd7b65ee56 on Nov 24, 2019
  28. PastaPastaPasta referenced this in commit 74d34d1df5 on Jan 26, 2020
  29. PastaPastaPasta referenced this in commit 10d269c2bd on Jan 26, 2020
  30. PastaPastaPasta referenced this in commit 211c8a3a5b on Jan 27, 2020
  31. ckti referenced this in commit 3819f9187c on Mar 28, 2021
  32. gades referenced this in commit 543ab639bb on Jun 25, 2021
  33. bitcoin 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-05-20 06:55 UTC