HomePhabricator

zmq test: fix flakiness by using more robust sync method

Description

zmq test: fix flakiness by using more robust sync method

Summary:
After connecting the subscriber sockets to the node, there is no
guarantee that the node's zmq publisher interfaces are ready yet, which
means that potentially the first expected notification messages could
get lost and the test fails. Currently this is handled by just waiting
for a short period of time (200ms), which works most of the time but is
still problematic, as in some rare cases the setup time takes much
longer, even in the range of multiple seconds.

The solution in this commit approaches the problem by using a more
robust method of syncing up, originally proposed by instagibbs:

  1. Generate a block on the node
  2. Try to receive a notification on all subscribers
  3. If all subscribers get a message within the timeout (1 second), we are done, otherwise repeat starting from step 1

This is a backport of core#21008 [3/3]
https://github.com/bitcoin/bitcoin/pull/21008/commits/5c6546362dce8b468268578e345c37ed515a1855

Depends on D10590

Test Plan: ninja check-functional

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D10591

Details

Provenance
Sebastian Falbesoner <sebastian.falbesoner@gmail.com>Authored on Nov 30 2021, 17:27
PiRKCommitted on Nov 30 2021, 17:27
PiRKPushed on Nov 30 2021, 17:27
Reviewer
Restricted Project
Differential Revision
D10591: zmq test: fix flakiness by using more robust sync method
Parents
rABC320e98a7e436: zmq test: accept arbitrary sequence start number in ZMQSubscriber
Branches
Unknown
Tags
Unknown