-
Notifications
You must be signed in to change notification settings - Fork 37.7k
test: fix intermittent failure in p2p_sendtxrcncl.py #26448
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -625,6 +625,10 @@ def add_outbound_p2p_connection(self, p2p_conn, *, wait_for_verack=True, p2p_idx | |
This method adds the p2p connection to the self.p2ps list and returns | ||
the connection to the caller. | ||
p2p_idx must be different for simultaneously connected peers. When reusing it for the next peer | ||
after disconnecting the previous one, it is necessary to wait for the disconnect to finish to avoid | ||
a race condition. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe mention that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried to describe it in more general terms because |
||
""" | ||
|
||
def addconnection_callback(address, port): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is racy, so you'd have to call
self.nodes[0].disconnect_p2ps()
or use a unique indexThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain why? We called
disconnect_p2ps()
beforeadd_outbound_p2p_connection
, so are guaranteed to have no peer when doing so. Within thewith
block we callwait_for_disconnect
(which waits until the disconnect initiated by the node is completed), so the subsequent subtest also shouldn't be able to run before the disconnect of the current one is completed. What am I missing?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, right. As the disconnect happens on the side of the node, there shouldn't be a race where the node is not aware of the disconnect.