Hmm... Thanks a lot. I think the problem may be related to the connects/disconnects. Even if I am always reconnecting blocks, some freezes happen sometimes in the disconnect() commands.
Is the patch you are refering to the new gnu version 3.5.3? Also, I would like to know if there is a better method than the "sleep" commands I used for letting the circuit for a short period of time. I mean, I used a head block to select just a few samples at the end of the circuit, but if I don't use the time.sleep(), the python script won't wait until I get the number of samples I need. So what I am asking is a type of semaphore command that lets the python script know when the gnuradio graph has already finished. Tom Rondeau-2 wrote: > > On Thu, Apr 5, 2012 at 5:11 AM, frankist <francisco_pais...@hotmail.com> > wrote: >> >> It seems I found the solution, in spite of not knowing the reason. >> >> I just have to re-assign a new block to each block variable every time I >> re-connect them. It seems that connecting and disconnecting the same >> blocks >> several times was the cause for the segmentation fault. > > You shouldn't have to do that. What version of GNU Radio are you > using, and are you on a 32-bit platform? This might be related to a > bug in the disconnect/reconnect calls that was patched recently. > > You can use the following link as a guide to debugging segfaults when > they occur: > > http://gnuradio.org/redmine/projects/gnuradio/wiki/FAQ#How-do-I-debug-GNU-Radio-in-Python > > Tom > > >> frankist wrote: >>> >>> Hi, >>> >>> I am having a hard time with a "segmentation fault" error. I am no >>> expert >>> in python (I just started to use it last week) but I find it difficult >>> to >>> believe that a segmentation fault error would appear in python code. >>> However, I am not using any block made by me. >>> >>> So this is the part of my code where there is an segmentation fault: >>> >>> def measure_callback(self,kv): >>> print "Measuring!!" >>> if self.state==SNR_MEASURE: >>> print "Measuring SNR" >>> self.lock() >>> self.disconnect((self.gr_file_source_0, 0), >>> (self.gr_throttle_0,0), self.fft_sink) >>> self.connect((self.gr_file_source_0, 0), >>> (self.gr_complex_to_mag_squared_0, 0), (self.gr_moving_average_ff_1, 0), >>> (self.gr_multiply_const_ff_0, 0), self.pwr_measure) >>> self.unlock() >>> time.sleep(5) >>> snr_val=10*math.log(self.pwr_measure.level()) >>> print "SNR measured = ", snr_val >>> self.lock() >>> self.disconnect((self.gr_file_source_0, >>> 0),(self.gr_complex_to_mag_squared_0, 0), (self.gr_moving_average_ff_1, >>> 0), (self.gr_multiply_const_ff_0, 0), self.pwr_measure) >>> self.connect((self.gr_file_source_0, 0), >>> self.gr_throttle_0, >>> self.fft_sink) >>> self.unlock() >>> >>> So basically I am reading a signal from a file_source and showing its >>> FFT >>> on a graphical interface. Then when there is a callback from a button I >>> made, this measure_callback(self,kv) is called and I change my circuit >>> to >>> measure SNR. >>> >>> I used some prints and discovered that the "segmentation fault" happens >>> at >>> "time.sleep(5)". Lol. Furthermore, the error doesn't happen all the >>> times >>> I run this code. >>> >>> Unfortunately, I don't know any type of debugging programs for gnuradio >>> (I >>> don't know if there is one) but it would be very handy because with just >>> a >>> "Segmentation Fault" message with no traceback it is difficult to know >>> what to do. >>> >>> So, any suggestion about what might be causing this problem? >>> >>> Francisco >>> >> >> -- >> View this message in context: >> http://old.nabble.com/Debugging-in-gnuradio-tp33557751p33568799.html >> Sent from the GnuRadio mailing list archive at Nabble.com. >> >> >> _______________________________________________ >> Discuss-gnuradio mailing list >> Discuss-gnuradio@gnu.org >> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio > > _______________________________________________ > Discuss-gnuradio mailing list > Discuss-gnuradio@gnu.org > https://lists.gnu.org/mailman/listinfo/discuss-gnuradio > > -- View this message in context: http://old.nabble.com/Debugging-in-gnuradio-tp33557751p33660247.html Sent from the GnuRadio mailing list archive at Nabble.com. _______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio