p2p_disconnect_ban intermittent issue #26808

issue maflcko opened this issue on January 4, 2023
  1. maflcko commented at 11:35 AM on January 4, 2023: member

    https://cirrus-ci.com/task/5426348117196800?logs=ci#L4502

     test  2022-12-17T13:12:20.699000Z TestFramework.utils (ERROR): wait_until() failed. Predicate: '''' 
                                               self.wait_until(lambda: sum(peer['version'] != 0 for peer in to_connection.getpeerinfo()) == to_num_peers)
                                       '''
     test  2022-12-17T13:12:20.699000Z TestFramework (ERROR): Assertion failed 
                                       Traceback (most recent call last):
                                         File "/tmp/cirrus-ci-build/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/test_framework/test_framework.py", line 134, in main
                                           self.run_test()
                                         File "/tmp/cirrus-ci-build/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/p2p_disconnect_ban.py", line 112, in run_test
                                           self.connect_nodes(0, 1)  # reconnect the node
                                         File "/tmp/cirrus-ci-build/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/test_framework/test_framework.py", line 608, in connect_nodes
                                           self.wait_until(lambda: sum(peer['version'] != 0 for peer in to_connection.getpeerinfo()) == to_num_peers)
                                         File "/tmp/cirrus-ci-build/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/test_framework/test_framework.py", line 732, in wait_until
                                           return wait_until_helper(test_function, timeout=timeout, timeout_factor=self.options.timeout_factor)
                                         File "/tmp/cirrus-ci-build/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/test/functional/test_framework/util.py", line 281, in wait_until_helper
                                           raise AssertionError("Predicate {} not true after {} seconds".format(predicate_source, timeout))
                                       AssertionError: Predicate ''''
                                               self.wait_until(lambda: sum(peer['version'] != 0 for peer in to_connection.getpeerinfo()) == to_num_peers)
                                       ''' not true after 2400.0 seconds
    
  2. maflcko added the label Bug on Jan 4, 2023
  3. maflcko added the label Tests on Jan 4, 2023
  4. fanquake commented at 11:51 AM on January 17, 2023: member
  5. maflcko renamed this:
    p2p_disconnect_ban issue
    p2p_disconnect_ban intermittent issue
    on Jan 18, 2023
  6. maflcko referenced this in commit d91364fdd9 on Jan 18, 2023
  7. brunoerg commented at 2:49 PM on February 17, 2023: contributor
    self.log.info("disconnectnode: successfully disconnect node by address")
    address1 = self.nodes[0].getpeerinfo()[0]['addr']
    self.nodes[0].disconnectnode(address=address1)
    self.wait_until(lambda: len(self.nodes[0].getpeerinfo()) == 1, timeout=10)
    assert not [node for node in self.nodes[0].getpeerinfo() if node['addr'] == address1]
    

    We call disconnectnode and check if it worked by getpeerinfo. Perhaps, internally is it updating the informations before really compliting the disconnection? So, when node0 call disconnectnode (to disconnect node1) we could check whether it really disconnected by checking getpeerinfo for node1?

    E.g.: Here we first remove from m_nodes (so getpeerinfo won't return that node anymore) and then we do the rest:

     if (pnode->fDisconnect)
      {
          // remove from m_nodes
          m_nodes.erase(remove(m_nodes.begin(), m_nodes.end(), pnode), m_nodes.end());
    
          // release outbound grant (if any)
          pnode->grantOutbound.Release();
    
          // close socket and cleanup
          pnode->CloseSocketDisconnect();
    
          // hold in disconnected pool until all refs are released
          pnode->Release();
          m_nodes_disconnected.push_back(pnode);
      }
    
  8. fanquake closed this on Feb 20, 2023

  9. sidhujag referenced this in commit c37110e733 on Feb 25, 2023
  10. bitcoin locked this on Feb 20, 2024

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-24 09:14 UTC

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