I’m struggling to understand an issue I’m having with a simple python
block with a registered message port connected to the copy block.
The python block looks like this: it literally does nothing, it just
happens to have a message port registered:
gr.sync_block.init(self, name=“sink”, in_sig=[np.float32],
self.signal = pmt.from_bool(False)
self.port_name = pmt.intern(“sig”)
def work(self, input_items, output_items):
Then I have a gr.unittest case that connects a vector_source, the copy
block, and the above signal sink:
src_data = np.arange(1000)
src = blocks.vector_source_f(src_data)
copy = blocks.copy(gr.sizeof_float)
msg_debug = blocks.message_debug()
sig_sink = signal_sink()
self.tb.connect(src, copy, sig_sink)
self.tb.msg_connect(sig_sink, “sig”, copy, “en”)
# Run once (this run is successful) self.tb.run() # Run again (this run hangs) src.rewind() self.tb.run()
The second time the flowgraph is “run”, it hangs indefinitely. GDB shows
sig_sink’s thread state as
#0 [email protected]@GLIBC_2.3.2 ()
Commenting out the “self.tb.msg_connect” line stops the hang, as does
connecting sig_sink’s message port to a message_debug block (which is
not in the flowgraph).
All this even though the sig_sink block doesn’t send any signals over
its message port.
Any hints would be very much appreciated, my debugging prowess has taken
me as far as it’s going to take me.
I’ve attached the complete test file that you can run with “python
Thanks in advance,