Ensure server command main thread doesn't exit

This patch adds join calls on the running threads to prevent
the main thread from exiting prematurely.
This commit is contained in:
Hemna 2023-01-07 14:57:25 -05:00
parent 233d49bb4c
commit c5aba17ad1
5 changed files with 44 additions and 30 deletions

View File

@ -63,12 +63,16 @@ class KISS3Client:
pass
def parse_frame(self, frame_bytes):
frame = Frame.from_bytes(frame_bytes)
# Now parse it with aprslib
kwargs = {
"frame": frame,
}
self._parse_callback(**kwargs)
try:
frame = Frame.from_bytes(frame_bytes)
# Now parse it with aprslib
kwargs = {
"frame": frame,
}
self._parse_callback(**kwargs)
except Exception as ex:
LOG.error("Failed to parse bytes received from KISS interface.")
LOG.exception(ex)
def consumer(self, callback, blocking=False, immortal=False, raw=False):
LOG.debug("Start blocking KISS consumer")

View File

@ -105,4 +105,7 @@ def server(ctx, flush):
log_monitor = threads.log_monitor.LogMonitorThread()
log_monitor.start()
rx_thread.join()
process_thread.join()
return 0

View File

@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.10
# This file is autogenerated by pip-compile with Python 3.9
# by the following command:
#
# pip-compile --annotation-style=line --resolver=backtracking dev-requirements.in
@ -20,19 +20,20 @@ click==8.1.3 # via black, pip-tools
colorama==0.4.6 # via tox
commonmark==0.9.1 # via rich
configargparse==1.5.3 # via gray
coverage[toml]==7.0.1 # via pytest-cov
coverage[toml]==7.0.3 # via pytest-cov
distlib==0.3.6 # via virtualenv
docutils==0.19 # via sphinx
exceptiongroup==1.1.0 # via pytest
filelock==3.8.2 # via tox, virtualenv
filelock==3.9.0 # via tox, virtualenv
fixit==0.1.4 # via gray
flake8==6.0.0 # via -r dev-requirements.in, fixit, pep8-naming
gray==0.13.0 # via -r dev-requirements.in
identify==2.5.11 # via pre-commit
identify==2.5.12 # via pre-commit
idna==3.4 # via requests
imagesize==1.4.1 # via sphinx
importlib-resources==5.10.1 # via fixit
iniconfig==1.1.1 # via pytest
importlib-metadata==6.0.0 # via sphinx
importlib-resources==5.10.2 # via fixit
iniconfig==2.0.0 # via pytest
isort==5.11.4 # via -r dev-requirements.in, gray
jinja2==3.1.2 # via sphinx
jsonschema==4.17.3 # via fixit
@ -47,14 +48,14 @@ pathspec==0.10.3 # via black
pep517==0.13.0 # via build
pep8-naming==0.13.3 # via -r dev-requirements.in
pip-tools==6.12.1 # via -r dev-requirements.in
platformdirs==2.6.0 # via black, tox, virtualenv
platformdirs==2.6.2 # via black, tox, virtualenv
pluggy==1.0.0 # via pytest, tox
pre-commit==2.21.0 # via -r dev-requirements.in
pycodestyle==2.10.0 # via flake8
pyflakes==3.0.1 # via autoflake, flake8
pygments==2.13.0 # via rich, sphinx
pyproject-api==1.2.1 # via tox
pyrsistent==0.19.2 # via jsonschema
pygments==2.14.0 # via rich, sphinx
pyproject-api==1.4.0 # via tox
pyrsistent==0.19.3 # via jsonschema
pytest==7.2.0 # via -r dev-requirements.in, pytest-cov
pytest-cov==4.0.0 # via -r dev-requirements.in
pytz==2022.7 # via babel
@ -63,7 +64,7 @@ pyyaml==6.0 # via fixit, libcst, pre-commit
requests==2.28.1 # via sphinx
rich==12.6.0 # via gray
snowballstemmer==2.2.0 # via sphinx
sphinx==5.3.0 # via -r dev-requirements.in
sphinx==6.1.2 # via -r dev-requirements.in
sphinxcontrib-applehelp==1.0.2 # via sphinx
sphinxcontrib-devhelp==1.0.2 # via sphinx
sphinxcontrib-htmlhelp==2.0.0 # via sphinx
@ -73,14 +74,15 @@ sphinxcontrib-serializinghtml==1.1.5 # via sphinx
tokenize-rt==5.0.0 # via add-trailing-comma, pyupgrade
toml==0.10.2 # via autoflake
tomli==2.0.1 # via black, build, coverage, mypy, pep517, pyproject-api, pytest, tox
tox==4.0.18 # via -r dev-requirements.in
typing-extensions==4.4.0 # via libcst, mypy, typing-inspect
tox==4.2.6 # via -r dev-requirements.in
typing-extensions==4.4.0 # via black, libcst, mypy, typing-inspect
typing-inspect==0.8.0 # via libcst
unify==0.5 # via gray
untokenize==0.1.1 # via unify
urllib3==1.26.13 # via requests
virtualenv==20.17.1 # via pre-commit, tox
wheel==0.38.4 # via pip-tools
zipp==3.11.0 # via importlib-metadata, importlib-resources
# The following packages are considered to be unsafe in a requirements file:
# pip

View File

@ -17,7 +17,8 @@ update_checker
flask-socketio
eventlet
tabulate
rich
# Pinned due to gray needing 12.6.0
rich==12.6.0
# For the list-plugins pypi.org search scraping
beautifulsoup4
wrapt
@ -31,3 +32,7 @@ dataclasses
dacite2
oslo.config
rpyc
# Pin this here so it doesn't require a compile on
# raspi
cryptography==38.0.1
shellingham==1.5.0.post1

View File

@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.10
# This file is autogenerated by pip-compile with Python 3.9
# by the following command:
#
# pip-compile --annotation-style=line --resolver=backtracking requirements.in
@ -8,15 +8,15 @@ aprslib==0.7.2 # via -r requirements.in
attrs==22.2.0 # via -r requirements.in, ax253, kiss3
ax253==0.1.5.post1 # via kiss3
beautifulsoup4==4.11.1 # via -r requirements.in
bidict==0.22.0 # via python-socketio
bitarray==2.6.1 # via ax253, kiss3
bidict==0.22.1 # via python-socketio
bitarray==2.6.2 # via ax253, kiss3
certifi==2022.12.7 # via requests
cffi==1.15.1 # via cryptography
charset-normalizer==2.1.1 # via requests
click==8.1.3 # via -r requirements.in, click-completion, flask
click-completion==0.5.2 # via -r requirements.in
commonmark==0.9.1 # via rich
cryptography==38.0.4 # via pyopenssl
cryptography==38.0.1 # via -r requirements.in, pyopenssl
dacite2==2.0.0 # via -r requirements.in
dataclasses==0.6 # via -r requirements.in
debtcollector==2.5.0 # via oslo-config
@ -29,20 +29,20 @@ flask-socketio==5.3.2 # via -r requirements.in
greenlet==2.0.1 # via eventlet
idna==3.4 # via requests
imapclient==2.3.1 # via -r requirements.in
importlib-metadata==5.2.0 # via ax253, kiss3
importlib-metadata==6.0.0 # via ax253, flask, kiss3
itsdangerous==2.1.2 # via flask
jinja2==3.1.2 # via click-completion, flask
kiss3==8.0.0 # via -r requirements.in
markupsafe==2.1.1 # via jinja2
netaddr==0.8.0 # via oslo-config
oslo-config==9.0.0 # via -r requirements.in
oslo-config==9.1.0 # via -r requirements.in
oslo-i18n==5.1.0 # via oslo-config
pbr==5.11.0 # via -r requirements.in, oslo-i18n, stevedore
pluggy==1.0.0 # via -r requirements.in
plumbum==1.8.0 # via rpyc
plumbum==1.8.1 # via rpyc
pycparser==2.21 # via cffi
pygments==2.13.0 # via rich
pyopenssl==22.1.0 # via -r requirements.in
pygments==2.14.0 # via rich
pyopenssl==23.0.0 # via -r requirements.in
pyserial==3.5 # via pyserial-asyncio
pyserial-asyncio==0.6 # via kiss3
python-engineio==4.3.4 # via python-socketio
@ -53,7 +53,7 @@ requests==2.28.1 # via -r requirements.in, oslo-config, update-checker
rfc3986==2.0.0 # via oslo-config
rich==12.6.0 # via -r requirements.in
rpyc==5.3.0 # via -r requirements.in
shellingham==1.5.0 # via click-completion
shellingham==1.5.0.post1 # via -r requirements.in, click-completion
six==1.16.0 # via -r requirements.in, click-completion, eventlet, imapclient
soupsieve==2.3.2.post1 # via beautifulsoup4
stevedore==4.1.1 # via oslo-config