-
Notifications
You must be signed in to change notification settings - Fork 74
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
BUG: Handle item is None in certain conditions #1649
Conversation
Codecov ReportBase: 86.75% // Head: 86.76% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #1649 +/- ##
==========================================
+ Coverage 86.75% 86.76% +0.01%
==========================================
Files 95 95
Lines 9639 9652 +13
==========================================
+ Hits 8362 8375 +13
Misses 1277 1277
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
if viewer_item is None: | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this gets triggered when the viewer is removed from the app before the layer update messages are processed? If so, I think this makes sense as a good way to quickly prevent that case from causing issues. We don't need to worry about any of the following logic (which only affects things in the viewer, not higher in the stack) since the viewer is no longer in the app.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is for #1614 . I don't grok all the callback stuff but when this happens:
114 viewer_item = self.jdaviz_app._viewer_item_by_id(self.reference_id)
--> 115 selected_data_items = viewer_item['selected_data_items']
self.reference_id
actually points to the deleted viewer ID (not sure why, maybe upstream bug). So I think returning here is good enough until we find a better fix.
jdaviz/app.py
Outdated
if data_item is None: | ||
label = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what scenario triggers this case? I'm just trying to think if there's a way we can prevent it entirely, or if not if the warning that it will raise is warranted or will be to noisy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this one, I cannot reproduce it, so I just looked at the traceback at #689 (comment) and did my best guess.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, at least its not a common scenario then. I don't think the extra logic to prevent an error is a problem... as long as it doesn't result in a lot of warnings for the user. But I guess we'll at least have to reproduce (or find someone who can) before closing that issue. I'll try to do some testing before approving, but otherwise the code changes themselves look good to me! Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was able to reproduce #689 on main. This PR does prevent the traceback, but I still don't think the workflow in #689 is handled correctly. My vote would be to merge this PR as-is but NOT close that issue (which I'll update with what I'm seeing and how to reproduce) with this PR.
(Regression test coverage would be nice, but I'm not sure if API calls to remove viewers would have the signals processed in the same order to reproduce the traceback or not... it might be worth a shot though!)
I suppose both really (coverage for the new lines of code to ensure they avoid those tracebacks) |
50f7dba
to
1bd3d38
Compare
This comment was marked as outdated.
This comment was marked as outdated.
@kecnry , so I think only 2 remaining things:
|
7bf7a68
to
54e6b3e
Compare
@pllim - is the workflow I added in #689 not sufficient for the test? It looks like your change to appropriately handle the index does fix the original problem - I wonder if the |
Hmm... If it is not needed for this fix, I guess we can remove it. Lemme see. |
now creates a duplicate every time instead of overwriting the second one. This is different from original 0th order fix for spacetelescope#600
which I confirmed that it fails without this patch. Mark line to be excluded from bandit check. Update result for affected remote test.
so the error will crop back up for other cases
54e6b3e
to
5be2035
Compare
I think there are 2 different problems being discussed at Issue 689.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, I confirmed that both of the linked bugs are fixed by this. Thanks!
Thanks for the reviews! |
Description
This pull request is to not let Imviz crash in certain use cases. I am not sure how to write unit test for this.
Fixes #689
Fixes #1614
Checklist for package maintainer(s)
This checklist is meant to remind the package maintainer(s) who will review this pull request of some common things to look for. This list is not exhaustive.
trivial
label.CHANGES.rst
?