snstac / adsbcot

Display Aircraft in TAK - ADS-B to TAK Gateway
https://adsbcot.rtfd.io
Apache License 2.0
86 stars 22 forks source link

NoneType error when finding aircrafts #24

Open gncnpk opened 1 year ago

gncnpk commented 1 year ago

It seems ADSBCOT crashes when a aircraft is missing any one piece of information (id, lat, long, etc). My question is how should this be handled? Should it be logged and the program continues or if the piece of information isn't critical (lat, long I would consider the critical part), should it just not provide that information? My current workaround is having a try and except check in classes.py on line 255 and it just ignores any aircraft missing a certain piece of information.

ampledata commented 1 year ago

it shouldn't be crashing, it should just ignore the bad data. if you're seeing it crash, can you send me the stack trace?

On Wed, Feb 15, 2023 at 6:01 PM gncnpk @.***> wrote:

It seems ADSBCOT crashes when a aircraft is missing any one piece of information (id, lat, long, etc). My question is how should this be handled? Should it be logged and the program continues or if the piece of information isn't critical (lat, long I would consider the critical part), should it just not provide that information? My current workaround is having a try and except check in classes.py on line 255 and it just ignores any aircraft missing a certain piece of information.

— Reply to this email directly, view it on GitHub https://github.com/ampledata/adsbcot/issues/24, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAWIXUAQKV64AS3ZFJYDD3WXWDBHANCNFSM6AAAAAAU5SD4GI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- Greg Albrecht @.***> W2GMD EMT & ICT Specialist Signal: +1-310-621-9598 https://ampledata.org/ http://ampledata.org/ https://github.com/ampledata

gncnpk commented 1 year ago

@ampledata Sure can do! Once I get off work, I'll remove my try and except catch, and get you the trace back :)

gncnpk commented 1 year ago
ERROR:asyncio:Task exception was never retrieved
future: <Task finished name='Task-4' coro=<ADSBNetWorker.run() done, defined at /usr/local/lib/python3.9/dist-packages/adsbcot/classes.py:184> exception=AttributeError("'NoneType' object has no attribute 'replace'")>
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/adsbcot/classes.py", line 255, in run
    "flight": val.get("call", key).replace("_", ""),
AttributeError: 'NoneType' object has no attribute 'replace'
ERROR:asyncio:Fatal error on SSL transport
protocol: <asyncio.sslproto.SSLProtocol object at 0xb4583b20>
transport: <_SelectorSocketTransport closing fd=6>
Traceback (most recent call last):
  File "/usr/lib/python3.9/asyncio/selector_events.py", line 918, in write
    n = self._sock.send(data)
OSError: [Errno 9] Bad file descriptor

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.9/asyncio/sslproto.py", line 684, in _process_write_backlog
    self._transport.write(chunk)
  File "/usr/lib/python3.9/asyncio/selector_events.py", line 924, in write
    self._fatal_error(exc, 'Fatal write error on socket transport')
  File "/usr/lib/python3.9/asyncio/selector_events.py", line 719, in _fatal_error
    self._force_close(exc)
  File "/usr/lib/python3.9/asyncio/selector_events.py", line 731, in _force_close
    self._loop.call_soon(self._call_connection_lost, exc)
  File "/usr/lib/python3.9/asyncio/base_events.py", line 746, in call_soon
    self._check_closed()
  File "/usr/lib/python3.9/asyncio/base_events.py", line 510, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
ampledata commented 1 year ago

What ADS-B source are you using? (mind sharing your config.ini?)

gncnpk commented 1 year ago

Sure! I'm using dump1090-fa with a FlightAware Pro Stick Plus and here's my config.ini

[adsbcot]
PYTAK_TLS_CLIENT_CERT = /etc/my_client_cert.pem
PYTAK_TLS_CLIENT_KEY = /etc/my_client_cert.pem
PYTAK_TLS_DONT_VERIFY = true
COT_URL = tls://XX.XX.XX.XX:8089
DUMP1090_URL = tcp+beast://127.0.0.1:30005
gncnpk commented 1 year ago

So I saw your message in Discord and I'll probably be switching over to the JSON feed instead, but I still would like to help fix this potential bug or if it's not a bug, help others find the solution :)

ampledata commented 1 year ago

Hey @gncnpk, if you're running locally, I recommend switching to the new file:// based behavior, see: https://adsbcot.readthedocs.io/en/latest/config.html