Forum: GNU Radio Possible diagnosis for issue 520, hier_block2::disconnect_all() misbehavior

7aee58de3a50c13e688140bc06d60225?d=identicon&s=25 Kevin Reid (Guest)
on 2013-08-17 18:35
(Received via mailing list)
(I would have sent this as a comment on the issue tracker, but creating
an account didn't seem to give me permission to comment.)


I've been using GNU Radio (strictly via Python) and met what seems to be
the already-reported issue <http://gnuradio.org/redmine/issues/520>,
where a hier_block2 will misbehave after calling disconnect_all().

Specifically, according to the exceptions seen from Python, it forgets
that it has any inputs or outputs and rejects attempts to connect to
them; for example, "output port 0 out of range for throttle(2)"
resulting from self.connect(throttle, self).

I took a look at the code, and I found this suspicious bit in
hier_block2_detail.cc:

  void
  hier_block2_detail::disconnect_all()
  {
    d_fg->clear();
    d_blocks.clear();
    d_inputs.clear();
    d_outputs.clear();
  }

I have very little C++ experience, but if I understand correctly, the
last two lines will cause the input and output port vectors to have
length 0, which would explain the observed behavior. There does not seem
to be any code which increases the size of the vectors again.

If this is so, the fix would be to reset each element to the unset value
individually rather than removing elements. (I don't know how to write
that in idiomatic C++.)

I hope someone who has a working GNU Radio development environment (I've
tried and failed, which is an unrelated problem) can try this fix.

--
Kevin Reid                                  <http://switchb.org/kpreid/>
C539637020fd56193dd6daec746c4a84?d=identicon&s=25 Tom Rondeau (Guest)
on 2013-08-19 18:17
(Received via mailing list)
On Sat, Aug 17, 2013 at 12:33 PM, Kevin Reid <kpreid@switchb.org> wrote:
> (I would have sent this as a comment on the issue tracker, but creating an
account didn't seem to give me permission to comment.)

See this in the FAQ for posting:

http://gnuradio.org/redmine/projects/gnuradio/wiki...

I have added you to the GNU Radio project so you can post now.

>     d_blocks.clear();
> --
> Kevin Reid                                  <http://switchb.org/kpreid/>

This is really good information. Johnathan and I will look it over and
discuss it.

Thanks!

--
Tom
Visit us at GRCon13 Oct. 1 - 4
http://www.trondeau.com/grcon13
D3e3c5e41e9aed486856802be823e181?d=identicon&s=25 Johnathan Corgan (Guest)
on 2013-08-25 19:51
(Received via mailing list)
On Mon, Aug 19, 2013 at 9:16 AM, Tom Rondeau <tom@trondeau.com> wrote:


> >   }
> > I hope someone who has a working GNU Radio development environment (I've
> tried and failed, which is an unrelated problem) can try this fix.
>
> This is really good information. Johnathan and I will look it over and
> discuss it.
>

This issue was fixed this morning.  The two lines in question were
indeed
the fault; instead of clearing the vectors, they should have been
recreated
with empty contents as is done in the constructor to initialize them.

Thanks.
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.