No description provided.
qa: Test ZMQ notification after chain reorg #16404
pull promag wants to merge 3 commits into bitcoin:master from promag:2019-07-zmq-reorg changing 2 files +59 −39-
promag commented at 1:45 PM on July 17, 2019: member
- fanquake added the label Tests on Jul 17, 2019
- promag force-pushed on Jul 17, 2019
- promag force-pushed on Jul 17, 2019
- promag force-pushed on Jul 17, 2019
- promag force-pushed on Jul 17, 2019
-
in test/functional/interface_zmq.py:60 in e11aa5a6f2 outdated
60 | # that this test fails if the publishing order changes. 61 | # Note that the publishing order is not defined in the documentation and 62 | # is subject to change. 63 | - self.zmq_context = zmq.Context() 64 | - socket = self.zmq_context.socket(zmq.SUB) 65 | + import zmq
kallewoof commented at 9:19 AM on August 5, 2019:Is it normal to import stuff in the middle of a file in python? Don't see it often. And you could remove the one below in
test_reorgif you just moved this to top..
promag commented at 9:29 AM on August 5, 2019:This was already the case. It's like this to not break if zmq module is not available. See
skip_if_no_py3_zmq()above.
kallewoof commented at 9:36 AM on August 5, 2019:Ah, that makes sense..
MarcoFalke commented at 12:53 PM on August 5, 2019:Can move the
import zmqright after the lineskip_if_no_bitcoind_zmq? :)
promag commented at 12:56 PM on August 5, 2019:Really? It's then available to other scopes? I'll try.
promag commented at 2:24 PM on August 5, 2019:If I remove import
zmqand keep the one you said I getNameError: name 'zmq' is not defined.laanwj commented at 12:44 PM on August 5, 2019: memberACK e11aa5a6f2683741567f0aaa08d3b198d219913f
in doc/zmq.md:116 in e11aa5a6f2 outdated
110 | @@ -111,7 +111,9 @@ using other means such as firewalling. 111 | 112 | Note that when the block chain tip changes, a reorganisation may occur 113 | and just the tip will be notified. It is up to the subscriber to 114 | -retrieve the chain from the last known block to the new tip. 115 | +retrieve the chain from the last known block to the new tip. Also note 116 | +that no notification occurs if the tip was in the active chain - this 117 | +is the case after calling invalidateblock RPC.
MarcoFalke commented at 12:52 PM on August 5, 2019:invalidateblockis not for production purposes, so I'd rather not mention that here. At most I'd mention this in the invalidateblock rpc itself.
promag commented at 12:55 PM on August 5, 2019:Good point, I'll improve
invalidateblockhelp then.
promag commented at 2:25 PM on August 5, 2019:Done.
in test/functional/interface_zmq.py:14 in be08278a3f outdated
9 | @@ -10,12 +10,11 @@ 10 | from test_framework.messages import CTransaction 11 | from test_framework.util import ( 12 | assert_equal, 13 | + connect_nodes, 14 | hash256, 15 | ) 16 | from io import BytesIO 17 | 18 | -ADDRESS = "tcp://127.0.0.1:28332"
MarcoFalke commented at 12:55 PM on August 5, 2019:in commit be08278a3f7348a346b60421b2c929a86020a4db
Would be nice to give a rationale for this "refactor". Otherwise, I'd be NACK on this commit
laanwj commented at 1:16 PM on August 5, 2019:I think this was moved into the specific test because the other test uses a different address, so there's no reason to share this globally
promag commented at 1:18 PM on August 5, 2019:Yes, the refactor is to avoid state and constants across test cases.
laanwj commented at 1:44 PM on August 5, 2019:Avoiding constants across test cases is not a goal in itself though. If you can share, say, constants for magic values that's good. Just in this specific caseā¦
promag commented at 1:52 PM on August 5, 2019:I mean that each test case needs a different address and I thought having a constant for each test is pointless, that's why I moved the value inline.
But I'll happily revert, the refactor is just to simplify the next commit - I'll add a rationale.
MarcoFalke commented at 2:11 PM on August 5, 2019:Sorry, didn't realize they were different addresses. ACK in that case.
promag commented at 2:25 PM on August 5, 2019:Rationale added.
promag force-pushed on Aug 5, 2019DrahtBot commented at 2:07 AM on August 14, 2019: member<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--174a7506f384e20aa4161008e828411d-->
Conflicts
No conflicts as of last run.
DrahtBot added the label Needs rebase on Aug 14, 2019doc: Add note regarding ZMQ block notification 6bc1ff915dqa: Refactor ZMQ test aa2622a726qa: Test ZMQ notification after chain reorg abdfc5e89bpromag force-pushed on Aug 19, 2019promag commented at 12:26 AM on August 19, 2019: memberRebased.
DrahtBot removed the label Needs rebase on Aug 19, 2019promag commented at 10:21 AM on August 25, 2019: memberIMO this is ready to merge.
MarcoFalke commented at 1:14 PM on August 26, 2019: memberIndeed. Thanks for the ping
MarcoFalke referenced this in commit af4100cd6f on Aug 26, 2019MarcoFalke merged this on Aug 26, 2019MarcoFalke closed this on Aug 26, 2019promag deleted the branch on Aug 26, 2019sidhujag referenced this in commit 0ff97617aa on Aug 27, 2019MarcoFalke commented at 7:31 PM on August 27, 2019: memberThis test fails on travis
promag commented at 9:46 PM on August 27, 2019: memberThe test should run pretty fast, on my system around 1s:
2019-08-27T20:59:50.749000Z TestFramework (INFO): Test the getzmqnotifications RPC 2019-08-27T20:59:51.603000Z TestFramework (INFO): Stopping nodesBut on one travis failure it takes around 60s to fail:
2019-08-27T17:18:36.885000Z TestFramework (INFO): Test the getzmqnotifications RPC 2019-08-27T17:19:37.373000Z TestFramework (ERROR): Unexpected exception caught during testingand looking at the error:
zmq.error.Again: Resource temporarily unavailableI assume the receive timeouts due to:
socket.set(zmq.RCVTIMEO, 60000)I suspect it happens because by the time the message is published there is no subscriber connected - this is called a "slow joiner" in http://zguide.zeromq.org/py:all#sockets-and-patterns - and I think this happens because we are
restart_nodeaftersocket.connect. I'll submit a PR to invert this order to see if it stops happening, otherwise we'll have to make sure the subscriber is ready before publishing messages.jasonbcox referenced this in commit a9f7ee10d4 on Sep 3, 2020jasonbcox referenced this in commit ce6847916a on Sep 3, 2020jasonbcox referenced this in commit 14653a00bd on Sep 3, 2020vijaydasmp referenced this in commit df73c4f5a3 on Dec 6, 2021vijaydasmp referenced this in commit 4778f9ecf9 on Dec 10, 2021vijaydasmp referenced this in commit 76edb07716 on Dec 13, 2021vijaydasmp referenced this in commit 27d2330375 on Dec 13, 2021vijaydasmp referenced this in commit cf43f40fb4 on Dec 15, 2021DrahtBot locked this on Dec 16, 2021
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-13 15:14 UTC
More mirrored repositories can be found on mirror.b10c.me