Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #200 - Move SLE class vars to instance vars #202

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

christianmkuss
Copy link

When running more than one class that inherits from SLE, _state, _handlers, _data_queue, and _invoke_id become shared. The most common issue this creates is if data is being inserted into the data queue that is being shared. Data will be given to any of the children even if the PDU does not match what the child knows about.

By making these instance level attributes data is kept confined to the individual member and is not shared.

Additionally, if a socket is closed abruptly, the _state should be reset to "unbound" because the only way to reset it would be to destroy the object.

patch_all is not required as the only thing being monkey patched for gevents is time. By running patch_all, issues arise when running non-gevent queues in calling applications.

_telem_sock should only be created when connecting, not on class instantiation

Running the same workflow as defined in the issue ticket the output is now

2022-12-07T15:08:31.652 | INFO     | Starting conn monitor for <class 'ait.dsn.sle.raf.RAF'>
2022-12-07T15:08:31.652 | INFO     | Configuring SLE connection...
2022-12-07T15:08:31.653 | INFO     | SLE connection configuration successful
2022-12-07T15:08:31.653 | INFO     | Sending Bind request ...
<class 'ait.dsn.sle.raf.RAF'>
2022-12-07T15:08:31.657 | INFO     | Bind successful
2022-12-07T15:08:32.655 | INFO     | Sending data start invocation ...
<class 'ait.dsn.sle.raf.RAF'>
2022-12-07T15:08:32.660 | INFO     | Start successful
<class 'ait.dsn.sle.raf.RAF'>
2022-12-07T15:08:33.669 | INFO     | Connection to DSN successful through localhost.
2022-12-07T15:08:33.669 | INFO     | Starting conn monitor for <class 'ait.dsn.sle.cltu.CLTU'>
2022-12-07T15:08:33.669 | INFO     | Configuring SLE connection...
2022-12-07T15:08:33.669 | INFO     | SLE connection configuration successful
2022-12-07T15:08:33.670 | INFO     | Sending Bind request ...
<class 'ait.dsn.sle.cltu.CLTU'>
2022-12-07T15:08:33.674 | INFO     | Bind successful
<class 'ait.dsn.sle.raf.RAF'>
2022-12-07T15:08:34.674 | INFO     | Sending data start invocation ...
<class 'ait.dsn.sle.cltu.CLTU'>
2022-12-07T15:08:34.679 | INFO     | Start Successful
<class 'ait.dsn.sle.raf.RAF'>
<class 'ait.dsn.sle.raf.RAF'>
<class 'ait.dsn.sle.raf.RAF'>

Which demonstrates that all frames received on 5307 are correctly being sent to the RAF queue.

Fixes #200

@christianmkuss christianmkuss requested review from a team as code owners December 7, 2022 23:19
When running more than one class that inherits from SLE, _state, _handlers,
_data_queue, and _invoke_id become shared. The most common issue this
creates is if data is being inserted into the data queue that is being
shared. Data will be given to any of the children even if the PDU
does not match what the child knows about.

By making these instance level attributes data is kept confined
to the individual member and is not shared.

Additionally, if a socket is closed abruptly, the _state should
be reset to "unbound" because the only way to reset it would be
to destroy the object. The socket should be reset to None
if it is ever closed.

patch_all is not required as the only thing being monkey patched
for gevents is time. By running patch_all, issues arise when running
non-gevent queues in calling applications.

_telem_sock should only be created when connecting, not on class instantiation

Fixes NASA-AMMOS#200
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SLE Common Class Variables Should be Instance Variables
1 participant