discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] tunnel.py buffer crash


From: yyzhuang
Subject: Re: [Discuss-gnuradio] tunnel.py buffer crash
Date: Wed, 18 Mar 2009 22:36:17 -0700 (PDT)

Hi Eric,

We read through the code. gr_buffer is a circular/ring buffer, so when
reading/writing through it, we need to take modular into account. The assert
error, it's line 125 in gr_buffer.h
(gnuradio/gnuradio-core/src/lib/runtime/gr_buffer.h):

  unsigned
  index_add (unsigned a, unsigned b)
  {
    unsigned s = a + b;

    if (s >= d_bufsize)
      s -= d_bufsize;

    assert (s < d_bufsize);
    return s;
  } 

It is invoked by

void
gr_buffer::update_write_pointer (int nitems)
{
  scoped_lock   guard(*mutex());
  d_write_index = index_add (d_write_index, nitems);
}

void
gr_buffer_reader::update_read_pointer (int nitems)
{
  scoped_lock   guard(*mutex());
  d_read_index = d_buffer->index_add (d_read_index, nitems);
} 

I think it wants to add d_write_index or d_read_index by nitems. But when
arrival rate is higher than service rate, buffer overflow occurs. Do you
know how to increase the buffer size? Thanks.

Yanyan


Eric Blossom wrote:
> 
> On Thu, Mar 12, 2009 at 10:01:28AM -0700, yyzhuang wrote:
>> 
>> Hi Eric,
>> 
>> The command line: sudo ./tunnel.py --freq 2.44G --bitrate 500k -v (is
>> bitrate has something to do with buffer?)
>> 
>> I installed GNU Radio from here: svn co
>> http://gnuradio.org/svn/gnuradio/branches/releases/3.1 gnuradio 
> 
> Thanks.
> 
>> I never had that buffer problem before I moved the 2 boxes to another lab
>> (from computer science lab to ee lab). Will it because of the higher
>> interference in the busier channel that caused too many packets being
>> queued
>> in the buffer, and caused the buffer over flow? 
> 
> No, the error message most likely indicates an internal error in one
> of the blocks.  If you can reproduce the problem and can grab a gdb
> backtrace when it happens, that would be very helpful in figuring out
> which block has the problem.
> 
> Here's how to use gdb with python. Add the code below to the top of
> tunnel.py, after all the imports.
> 
>     Debugging with gdb
> 
>     If your block isn't working, and you can't sort it out through python
>     test cases or a few printfs in the code, you may want to use gdb to
>     debug it. The trick of course is that all of GNU Radio, including your
>     new block, is dynamically loaded into python for execution.
> 
>     Try this: In your python test code, after the relevant imports, print
>     out the process id and wait for a keystroke. In another window run gdb
>     and tell it to attach to the python process with the given process
>     id. At this point you can set breakpoints or whatever in your code. Go
>     back to the python window and hit Enter so it'll continue.
> 
>       #!/usr/bin/env python
>       from gnuradio import gr
> 
> 
>       # insert this in your test code...
>       import os
>       print 'Blocked waiting for GDB attach (pid = %d)' % (os.getpid(),)
>       raw_input ('Press Enter to continue: ')
>       # remainder of your test code follows...
> 
> Eric
> 
> 
> _______________________________________________
> Discuss-gnuradio mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/discuss-gnuradio
> 
> 

-- 
View this message in context: 
http://www.nabble.com/tunnel.py-buffer-crash-tp22470731p22594030.html
Sent from the GnuRadio mailing list archive at Nabble.com.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]