Refactor Buffer class PV disconnection logic for clarity - #24
Merged
Conversation
…ffer and EventDefinition classes
kabanaty
commented
Jun 18, 2026
Comment on lines
+274
to
+275
| except BaseException: | ||
| pass |
Author
There was a problem hiding this comment.
Not necessarily, I just don't want to crash out if pv_obj doesn't exist or can't disconnect for some reason.
Comment on lines
+274
to
+275
| except BaseException: | ||
| pass |
Collaborator
There was a problem hiding this comment.
Is there a specific exception we're catching here?
Comment on lines
+287
to
+288
| except BaseException: | ||
| context_cache.pop(name, None) |
Collaborator
There was a problem hiding this comment.
Finally might be more appropriate here.
eloise-nebula
requested changes
Jun 18, 2026
eloise-nebula
left a comment
Collaborator
There was a problem hiding this comment.
Nice work Tyler, this looks great. Just a couple comments on exception handling.
Author
|
I dropped all try/except/finally logic since we're checking for existence before the loop anyways. I'm not crazy about the lack of try/except logic because I don't want scans to fail because buffer cleanup failed, but it will teach us something about CA connections. |
eloise-nebula
approved these changes
Jun 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
During MD on 6/17, we encountered issues with the PV and CA cache filling up after repeated scans and leading to failed PV connections. Each wire scan instantiates ~250 PV objects that persist with an automatic monitor. This automatic monitor is convenient for "normal" PVs but buffer PVs have a different use-case.
After a buffer is released, there is no guarantee that the next buffer reserved will be the same number. This makes maintaining a connection to that buffer's HST PVs pointless, because the next
buffer.get()will be to a different PV, e.g.,HST5vs.HST8. The user does not need to maintain a monitor on theHST<num>PVs after the buffer is released.The initial code was a hotfix merged in without proper review. This PR is to address the code clarity and organization and provide a venue for discussion on the topic.