snstac / aprscot

aprscot - APRS to TAK Gateway.
https://github.com/snstac/aprscot
Apache License 2.0
45 stars 17 forks source link

Don't raise on bad APRS frames. #2

Closed ampledata closed 2 years ago

ampledata commented 3 years ago
ubuntu@ubuntu:~$ aprscot -c xxx-10 -U tcp:1.2.3.4:8088 -f 'm/200'
2021-05-14 17:52:53,641 pytak INFO - Using APRS Host: rotate.aprs.net:14580
2021-05-14 17:52:53,642 pytak INFO - Running EventTransmitter
2021-05-14 17:52:53,643 pytak INFO - Running APRSWorker
2021-05-14 17:52:53,647 pytak INFO - Running EventReceiver
2021-05-14 17:52:55,266 pytak INFO - Using APRS Filter: 'm/200'
Task completed: <Task finished name='Task-3' coro=<APRSWorker.run() done, defined at /usr/local/lib/python3.8/dist-packages/aprscot-4.0.0-py3.8.egg/aprscot/classes.py:71> exception=ParseError('invalid format')>
Task exception was never retrieved
future: <Task finished name='Task-3' coro=<APRSWorker.run() done, defined at /usr/local/lib/python3.8/dist-packages/aprscot-4.0.0-py3.8.egg/aprscot/classes.py:71> exception=ParseError('invalid format')>
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/aprscot-4.0.0-py3.8.egg/aprscot/classes.py", line 91, in run
    await self.handle_message(frame)
  File "/usr/local/lib/python3.8/dist-packages/aprscot-4.0.0-py3.8.egg/aprscot/classes.py", line 56, in handle_message
    aprs_frame = aprslib.parsing.parse(message)
  File "/usr/local/lib/python3.8/dist-packages/aprslib-0.6.47-py3.8.egg/aprslib/parsing/_init_.py", line 114, in parse
    _try_toparse_body(packet_type, body, parsed)
  File "/usr/local/lib/python3.8/dist-packages/aprslib-0.6.47-py3.8.egg/aprslib/parsing/_init_.py", line 204, in _try_toparse_body
    body, result = parse_position(packet_type, body)
  File "/usr/local/lib/python3.8/dist-packages/aprslib-0.6.47-py3.8.egg/aprslib/parsing/position.py", line 59, in parse_position
    raise ParseError("invalid format")
aprslib.exceptions.ParseError: invalid format
koneslager commented 3 years ago

I am having this same issue.

ampledata commented 3 years ago

I believe this is fixed here: https://github.com/ampledata/aprscot/blob/main/aprscot/classes.py#L54

Let me know if you're getting a different stacktrack.

koneslager commented 3 years ago

I found that is already in the classes.py file. So, but it still happening. Once it happens again, I will paste here.

koneslager commented 3 years ago

DEBUG:asyncio:<_SelectorSocketTransport fd=6 read=idle write=<idle, bufsize=0>>: Fatal write error on socket transport Traceback (most recent call last): File "/usr/lib/python3.7/asyncio/selector_events.py", line 857, in write n = self._sock.send(data) ConnectionResetError: [Errno 104] Connection reset by peer Task completed: <Task finished coro=<Worker.run() done, defined at /usr/local/lib/python3.7/dist-packages/pytak-3.5.2-py3.7.egg/pytak/classes.py:55> exception=ConnectionResetError('Connection lost') created at /usr/lib/python3.7/asyncio/tasks.py:361> ERROR:asyncio:Task exception was never retrieved future: <Task finished coro=<Worker.run() done, defined at /usr/local/lib/python3.7/dist-packages/pytak-3.5.2-py3.7.egg/pytak/classes.py:55> exception=ConnectionResetError('Connection lost') created at /usr/lib/python3.7/asyncio/tasks.py:361> source_traceback: Object created at (most recent call last): File "/usr/local/bin/aprscot", line 11, in load_entry_point('aprscot==4.0.0', 'console_scripts', 'aprscot')() File "/usr/local/lib/python3.7/dist-packages/aprscot-4.0.0-py3.7.egg/aprscot/commands.py", line 98, in cli asyncio.run(main(opts), debug=bool(os.environ.get('DEBUG'))) File "/usr/lib/python3.7/asyncio/runners.py", line 43, in run return loop.run_until_complete(main) File "/usr/lib/python3.7/asyncio/base_events.py", line 571, in run_until_complete self.run_forever() File "/usr/lib/python3.7/asyncio/base_events.py", line 539, in run_forever self._run_once() File "/usr/lib/python3.7/asyncio/base_events.py", line 1767, in _run_once handle._run() File "/usr/lib/python3.7/asyncio/events.py", line 88, in _run self._context.run(self._callback, *self._args) File "/usr/local/lib/python3.7/dist-packages/aprscot-4.0.0-py3.7.egg/aprscot/commands.py", line 56, in main return_when=asyncio.FIRST_COMPLETED) File "/usr/lib/python3.7/asyncio/tasks.py", line 361, in wait fs = {ensure_future(f, loop=loop) for f in set(fs)} File "/usr/lib/python3.7/asyncio/tasks.py", line 361, in fs = {ensure_future(f, loop=loop) for f in set(fs)} Traceback (most recent call last): File "/usr/local/lib/python3.7/dist-packages/pytak-3.5.2-py3.7.egg/pytak/classes.py", line 65, in run await self.handle_event(event) File "/usr/local/lib/python3.7/dist-packages/pytak-3.5.2-py3.7.egg/pytak/classes.py", line 100, in handle_event await self.writer.drain() File "/usr/lib/python3.7/asyncio/streams.py", line 348, in drain await self._protocol._drain_helper() File "/usr/lib/python3.7/asyncio/streams.py", line 202, in _drain_helper raise ConnectionResetError('Connection lost') ConnectionResetError: Connection lost DEBUG:asyncio:Close <_UnixSelectorEventLoop running=False closed=False debug=True> root@raspberrypi:/home/pi/aprscot#

ampledata commented 3 years ago

These two ConnectionResetError: [Errno 104] Connection reset by peer and ConnectionResetError: Connection lost Exceptions are sus.

Do you see any markers come across on your TAK client(s)?

ampledata commented 3 years ago