Bug Description
During testing there is a race condition in listen() in node_impl::listen_to_p2p_network() that appears quite frequently (see Github Actions logs e.g. https://github.com/bitshares/bitshares-core/actions/runs/34021597393/job/101455080081?pr=2833). The "bind - close (via object destruction) - rebind" approach is not ideal. A better approach is to not close the server socket if the first bind is successful, but keep and use it directly.
Ideally we also need a unit test case to cover the fix:
- if bind succeeds
- if bind fails
- if "p2p-endpoint" option is not set, retry port 0 one time
- if "p2p-endpoint" option is set, wait for a few seconds and then retry, repeat
Commit 8db58de in #1764 is related.
Impacts
Describe which portion(s) of BitShares Core may be impacted by this bug. Please tick at least one box.
Steps To Reproduce
Github Actions
Expected Behavior
Screenshots (optional)
Host Environment
- Host OS: Ubuntu 24.04 LTS
- Host Physical RAM
- BitShares Version: 7.0.2
- OpenSSL Version: 3.0
- Boost Version: 1.83
Additional Context (optional)
CORE TEAM TASK LIST
Bug Description
During testing there is a race condition in
listen()innode_impl::listen_to_p2p_network()that appears quite frequently (see Github Actions logs e.g. https://github.com/bitshares/bitshares-core/actions/runs/34021597393/job/101455080081?pr=2833). The "bind - close (via object destruction) - rebind" approach is not ideal. A better approach is to not close the server socket if the first bind is successful, but keep and use it directly.Ideally we also need a unit test case to cover the fix:
Commit 8db58de in #1764 is related.
Impacts
Describe which portion(s) of BitShares Core may be impacted by this bug. Please tick at least one box.
Steps To Reproduce
Github Actions
Expected Behavior
Screenshots (optional)
Host Environment
Additional Context (optional)
CORE TEAM TASK LIST