bistromath / gr-air-modes

Gnuradio Mode-S/ADS-B radio
This project implements a Mode S receiver for the Gnuradio software-defined radio project. It is designed to receive Mode S transmissions from aircraft and decode them to a human-readable format, including ADS-B information messages such as position and a
GNU General Public License v3.0
439 stars 126 forks source link

modes_rx SBS-1 crashes on Linux mint 16 x64 #64

Closed engink1981 closed 9 years ago

engink1981 commented 9 years ago

The app crashes after 1 hour running.

Traceback:

Exception in thread Thread-3: Traceback (most recent call last): File "/usr/lib/python2.7/threading.py", line 808, in bootstrap_inner self.run() File "/usr/local/lib/python2.7/dist-packages/air_modes/zmq_socket.py", line 101, in run self._pubsub[address] = msg File "/usr/local/lib/python2.7/dist-packages/gnuradio/gr/pubsub.py", line 52, in __setitem sub(val) File "/usr/local/lib/python2.7/dist-packages/air_modes/parse.py", line 433, in publish pub["type%i_dl" % ret.data.get_type()] = ret File "/usr/local/lib/python2.7/dist-packages/gnuradio/gr/pubsub.py", line 52, in setitem sub(val) File "/usr/local/lib/python2.7/dist-packages/air_modes/sbs1.py", line 95, in output sbs1_msg = self.parse(msg) File "/usr/local/lib/python2.7/dist-packages/air_modes/sbs1.py", line 142, in parse outmsg = self.pp4(msg.data, msg.ecc) File "/usr/local/lib/python2.7/dist-packages/air_modes/sbs1.py", line 165, in pp4 aircraft_id = self.get_aircraft_id(ecc) File "/usr/local/lib/python2.7/dist-packages/air_modes/sbs1.py", line 86, in get_aircraft_id for icao, _id in self._aircraft_id_map.iteritems(): RuntimeError: dictionary changed size during iteration

Some details: USRP B210 / UHD Linux Mint 16 x64 Python 2.7.5+ linux; GNU C++ version 4.8.1; Boost_1.53 gnuradio 3.7.3

PeteMole commented 9 years ago

Same issue on 32-bit Ubuntu 14.04.1 and gr3.7, running an rtl-sdr with -u osmocom and -P.

Exception in thread Thread-3: Traceback (most recent call last): File "/usr/lib/python2.7/threading.py", line 810, in bootstrap_inner self.run() File "/usr/local/lib/python2.7/dist-packages/air_modes/zmq_socket.py", line 101, in run self._pubsub[address] = msg File "/usr/local/lib/python2.7/dist-packages/gnuradio/gr/pubsub.py", line 52, in __setitem sub(val) File "/usr/local/lib/python2.7/dist-packages/air_modes/parse.py", line 433, in publish pub["type%i_dl" % ret.data.get_type()] = ret File "/usr/local/lib/python2.7/dist-packages/gnuradio/gr/pubsub.py", line 52, in setitem sub(val) File "/usr/local/lib/python2.7/dist-packages/air_modes/sbs1.py", line 95, in output sbs1_msg = self.parse(msg) File "/usr/local/lib/python2.7/dist-packages/air_modes/sbs1.py", line 140, in parse outmsg = self.pp0(msg.data, msg.ecc) File "/usr/local/lib/python2.7/dist-packages/air_modes/sbs1.py", line 155, in pp0 aircraft_id = self.get_aircraft_id(ecc) File "/usr/local/lib/python2.7/dist-packages/air_modes/sbs1.py", line 86, in get_aircraft_id for icao, _id in self._aircraft_id_map.iteritems(): RuntimeError: dictionary changed size during iteration

bistromath commented 9 years ago

I'm out for the weekend and will resolve this next week. Thanks for the report. On Nov 18, 2014 5:07 AM, "engink1981" notifications@github.com wrote:

The app crashes after 1 hour running.

Traceback:

Exception in thread Thread-3: Traceback (most recent call last): File "/usr/lib/python2.7/threading.py", line 808, in

_bootstrap_inner self.run() File "/usr/local/lib/python2.7/dist-packages/air_modes/zmq_socket.py", line 101, in run self._pubsub[address] = msg File "/usr/local/lib/python2.7/dist-packages/gnuradio/gr/pubsub.py", line 52, in _setitem sub(val) File "/usr/local/lib/python2.7/dist-packages/air_modes/parse.py", line 433, in publish pub["type%i_dl" % ret.data.get_type()] = ret File "/usr/local/lib/python2.7/dist-packages/gnuradio/gr/pubsub.py", line 52, in setitem sub(val) File "/usr/local/lib/python2.7/dist-packages/air_modes/sbs1.py", line 95, in output sbs1_msg = self.parse(msg) File "/usr/local/lib/python2.7/dist-packages/air_modes/sbs1.py", line 142, in parse outmsg = self.pp4(msg.data, msg.ecc) File "/usr/local/lib/python2.7/dist-packages/air_modes/sbs1.py", line 165, in pp4 aircraft_id = self.get_aircraft_id(ecc) File "/usr/local/lib/python2.7/dist-packages/air_modes/sbs1.py", line 86, in get_aircraft_id for icao, _id in self._aircraft_id_map.iteritems(): RuntimeError: dictionary changed size during iteration

Some details: Linux Mint 16 x64 Python 2.7.5+ linux; GNU C++ version 4.8.1; Boost_1.53 gnuradio 3.7.3

— Reply to this email directly or view it on GitHub https://github.com/bistromath/gr-air-modes/issues/64.

engink1981 commented 9 years ago

Is there any advance about bug fix?

macsmith commented 9 years ago

Hi, bistromath, will you be able to have a look at this problem? It's a great programme, just needs the dictionary problem fixed so it can run continuously.

TIA Ian

phileasF commented 9 years ago

Hi,

for a quick fix you can use this patch:

--- old/python/sbs1.py       2015-05-02 00:56:50.276933440 +0200
+++ new/python/sbs1.py       2015-05-02 00:56:54.039949968 +0200
@@ -83,7 +83,7 @@
     # dictionary is getting too large.
     if len(self._aircraft_id_map) > 1e4:
       minimum = min(self._aircraft_id_map.values()) + (len(self._aircraft_id_map) - 1e4)
-      for icao, _id in self._aircraft_id_map.iteritems():
+      for icao, _id in self._aircraft_id_map.items():
         if _id < minimum:
             del self._aircraft_id_map[icao]
engink1981 commented 9 years ago

dear phileasF, I have applied your patch,but after 70 minutes, it gives error given below,

Exception in thread Thread-3: Traceback (most recent call last): File "/usr/lib/python2.7/threading.py", line 810, in bootstrap_inner self.run() File "/usr/local/lib/python2.7/dist-packages/air_modes/zmq_socket.py", line 101, in run self._pubsub[address] = msg File "/usr/local/lib/python2.7/dist-packages/gnuradio/gr/pubsub.py", line 52, in __setitem sub(val) File "/usr/local/lib/python2.7/dist-packages/air_modes/parse.py", line 433, in publish pub["type%i_dl" % ret.data.get_type()] = ret File "/usr/local/lib/python2.7/dist-packages/gnuradio/gr/pubsub.py", line 52, in setitem sub(val) File "/usr/local/lib/python2.7/dist-packages/air_modes/msprint.py", line 161, in handle17 [velocity, heading, vert_spd] = air_modes.parseBDS09_1(msg.data) File "/usr/local/lib/python2.7/dist-packages/air_modes/parse.py", line 338, in parseBDS09_1 ns_vel <<= 2 TypeError: unsupported operand type(s) for <<=: 'float' and 'int'

phileasF commented 9 years ago

Hi,

this seems to be a different issue. It only seems to happen, when a certain kind of message is received. But I do not know much about the ADB-S protocol. The code should be easy to fix. But I have to test it before I can give you a patch.

bistromath commented 9 years ago

I have fixes for both issues and will be updating shortly. Sorry for the delay. On May 7, 2015 5:50 AM, "phileasF" notifications@github.com wrote:

Hi,

this seems to be a different issue. It only seems to happen, when a certain kind of message is received. But I do not know much about the ADB-S protocol. The code should be easy to fix. But I have to test it before I can give you a patch.

— Reply to this email directly or view it on GitHub https://github.com/bistromath/gr-air-modes/issues/64#issuecomment-99852171 .

bistromath commented 9 years ago

Both issues have fixes committed. Please give the latest master branch a try and verify it fixes your problem.

Best, Nick

On Thu, May 7, 2015 at 9:19 AM, Nick Foster bistromath@gmail.com wrote:

I have fixes for both issues and will be updating shortly. Sorry for the delay. On May 7, 2015 5:50 AM, "phileasF" notifications@github.com wrote:

Hi,

this seems to be a different issue. It only seems to happen, when a certain kind of message is received. But I do not know much about the ADB-S protocol. The code should be easy to fix. But I have to test it before I can give you a patch.

— Reply to this email directly or view it on GitHub https://github.com/bistromath/gr-air-modes/issues/64#issuecomment-99852171 .