-
Notifications
You must be signed in to change notification settings - Fork 10
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
SLE Common Class Variables Should be Instance Variables #200
Comments
I have changes made and can open a PR. |
christianmkuss
added a commit
to christianmkuss/AIT-DSN
that referenced
this issue
Dec 7, 2022
When running more than one class that inherits from SLE, _state, _handlers, _data_queue, and _invoke_id become shared. This most common this issue 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 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. Fixes NASA-AMMOS#200
christianmkuss
added a commit
to christianmkuss/AIT-DSN
that referenced
this issue
Dec 7, 2022
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 Fixes NASA-AMMOS#200
christianmkuss
added a commit
to christianmkuss/AIT-DSN
that referenced
this issue
Feb 24, 2023
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In ait/dsn/common.py there is the following code block
These class level variables will become shared by any instance inheriting from
SLE
which will create issues if multiple ofRAF
,RCF
, orCLTU
are created in the same scope. Looking at the examples in ait/dsn/bin/examples, I'm not sure this is a super common use case, but it is one I ran across. I believe it may also be avoidable by running each instance in threads.For example, I have configured a test bed that streams RAF frames over port 5307 and accepts CLTU over port 5112, after accepting bind, start, and similar logic.
Running this outputs (with
print(type(handler))
added to ait.dsn.sle.common::data_processor)This shows that the CLTU instance is able to decode but then the incoming RAF frames are put into a queue that is shared between CLTU and RAF (hence the error "Unable to decode PDU. Skipping ...")
The text was updated successfully, but these errors were encountered: