Opened 6 years ago
Last modified 6 years ago
#2279 accepted defect
Apparent race condition in remove-model trigger handling
Reported by: | Owned by: | pett | |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | General Controls | Version: | |
Keywords: | Cc: | Tom Goddard | |
Blocked By: | Blocking: | ||
Notify when closed: | Platform: | all | |
Project: | ChimeraX |
Description (last modified by )
The following bug report has been submitted: Platform: Darwin-18.6.0-x86_64-i386-64bit ChimeraX Version: 0.91 (2019-07-10) Description (Describe the actions that caused this problem to occur here) Log: Startup Messages --- warning | 'clip' is a prefix of an existing command 'clipper' UCSF ChimeraX version: 0.91 (2019-07-10) © 2016-2019 Regents of the University of California. All rights reserved. How to cite UCSF ChimeraX > open /Users/nadiariera/Downloads/cryosparc_P11_J33_004_volume_map.mrc Opened cryosparc_P11_J33_004_volume_map.mrc, grid size 400,400,400, pixel 0.834, shown at level 0.106, step 2, values float32 > set bgColor white > lighting full > toolshed show "Segment Map" Segmenting cryosparc_P11_J33_004_volume_map.mrc, density threshold 0.120577 Showing cryosparc_P11_J33_004_volume_map.seg - 0 regions, 0 surfaces Showing 23 region surfaces 30 watershed regions, grouped to 23 regions > select 3 models selected Segmenting cryosparc_P11_J33_004_volume_map.mrc, density threshold 0.119804 Showing cryosparc_P11_J33_004_volume_map.seg - 0 regions, 0 surfaces Showing 23 region surfaces 30 watershed regions, grouped to 23 regions > select clear Segmenting cryosparc_P11_J33_004_volume_map.mrc, density threshold 0.119804 Showing cryosparc_P11_J33_004_volume_map.seg - 0 regions, 0 surfaces Only showing 20 of 23 regions. Showing 20 of 23 region surfaces 30 watershed regions, grouped to 23 regions Segmenting cryosparc_P11_J33_004_volume_map.mrc, density threshold 0.119804 Showing cryosparc_P11_J33_004_volume_map.seg - 0 regions, 0 surfaces Showing 2 region surfaces 30 watershed regions, grouped to 2 regions Segmenting cryosparc_P11_J33_004_volume_map.mrc, density threshold 0.119804 Showing cryosparc_P11_J33_004_volume_map.seg - 0 regions, 0 surfaces Only showing 10 of 23 regions. Showing 10 of 23 region surfaces 30 watershed regions, grouped to 23 regions > lighting simple Smoothing and grouping, standard deviation 5 voxels Only showing 10 of 21 regions. Showing 10 of 21 region surfaces Got 21 regions after smoothing 5 voxels. > select ~sel 2 models selected > hide #!1 models > select ~sel Nothing selected > save "/Users/nadiariera/Desktop/S2C2 Project submission/Segmented_nanodisc_from_P11_J33_004.mrc" models #1 > hide #!2 models Traceback (most recent call last): File "/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/triggerset.py", line 130, in invoke return self._func(self._name, data) File "/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/segger/segment_dialog.py", line 1178, in model_closed_cb if self.chosen_map in mlist: File "/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/segger/segment_dialog.py", line 420, in _get_chosen_map return self._map_menu.value File "/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/ui/widgets/item_chooser.py", line 255, in value return self.item_map[text] KeyError: 'cryosparc_P11_J33_004_volume_map.mrc #1' Error processing trigger "remove models": 'cryosparc_P11_J33_004_volume_map.mrc #1': KeyError: 'cryosparc_P11_J33_004_volume_map.mrc #1' File "/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/ui/widgets/item_chooser.py", line 255, in value return self.item_map[text] See log for complete Python traceback. Traceback (most recent call last): File "/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/triggerset.py", line 130, in invoke return self._func(self._name, data) File "/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/ui/widgets/item_chooser.py", line 287, in _items_change prev_value = self.value File "/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/ui/widgets/item_chooser.py", line 255, in value return self.item_map[text] KeyError: 'cryosparc_P11_J33_004_volume_map.mrc #1' Error processing trigger "remove models": 'cryosparc_P11_J33_004_volume_map.mrc #1': KeyError: 'cryosparc_P11_J33_004_volume_map.mrc #1' File "/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/ui/widgets/item_chooser.py", line 255, in value return self.item_map[text] See log for complete Python traceback. Traceback (most recent call last): File "/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/triggerset.py", line 130, in invoke return self._func(self._name, data) File "/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/segger/segment_dialog.py", line 1178, in model_closed_cb if self.chosen_map in mlist: File "/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/segger/segment_dialog.py", line 420, in _get_chosen_map return self._map_menu.value File "/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/ui/widgets/item_chooser.py", line 255, in value return self.item_map[text] KeyError: 'cryosparc_P11_J33_004_volume_map.mrc #1' Error processing trigger "remove models": 'cryosparc_P11_J33_004_volume_map.mrc #1': KeyError: 'cryosparc_P11_J33_004_volume_map.mrc #1' [removed a bunch of these] File "/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/ui/widgets/item_chooser.py", line 255, in value return self.item_map[text] See log for complete Python traceback. Traceback (most recent call last): File "/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/triggerset.py", line 130, in invoke return self._func(self._name, data) File "/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/ui/widgets/item_chooser.py", line 287, in _items_change prev_value = self.value File "/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/ui/widgets/item_chooser.py", line 255, in value return self.item_map[text] KeyError: 'cryosparc_P11_J33_004_volume_map.mrc #1' Error processing trigger "remove models": 'cryosparc_P11_J33_004_volume_map.mrc #1': KeyError: 'cryosparc_P11_J33_004_volume_map.mrc #1' File "/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/ui/widgets/item_chooser.py", line 255, in value return self.item_map[text] See log for complete Python traceback. Traceback (most recent call last): File "/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/triggerset.py", line 130, in invoke return self._func(self._name, data) File "/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/segger/segment_dialog.py", line 1178, in model_closed_cb if self.chosen_map in mlist: File "/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/segger/segment_dialog.py", line 420, in _get_chosen_map return self._map_menu.value File "/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/ui/widgets/item_chooser.py", line 255, in value return self.item_map[text] KeyError: 'cryosparc_P11_J33_004_volume_map.mrc #1' Error processing trigger "remove models": 'cryosparc_P11_J33_004_volume_map.mrc #1': KeyError: 'cryosparc_P11_J33_004_volume_map.mrc #1' File "/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/ui/widgets/item_chooser.py", line 255, in value return self.item_map[text] See log for complete Python traceback. Traceback (most recent call last): File "/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/triggerset.py", line 130, in invoke return self._func(self._name, data) File "/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/ui/widgets/item_chooser.py", line 287, in _items_change prev_value = self.value File "/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/ui/widgets/item_chooser.py", line 255, in value return self.item_map[text] KeyError: 'cryosparc_P11_J33_004_volume_map.mrc #1' Error processing trigger "remove models": 'cryosparc_P11_J33_004_volume_map.mrc #1': KeyError: 'cryosparc_P11_J33_004_volume_map.mrc #1' File "/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/ui/widgets/item_chooser.py", line 255, in value return self.item_map[text] See log for complete Python traceback. Traceback (most recent call last): File "/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/triggerset.py", line 130, in invoke return self._func(self._name, data) File "/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/segger/segment_dialog.py", line 1178, in model_closed_cb if self.chosen_map in mlist: File "/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/segger/segment_dialog.py", line 420, in _get_chosen_map return self._map_menu.value File "/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/ui/widgets/item_chooser.py", line 255, in value return self.item_map[text] KeyError: 'cryosparc_P11_J33_004_volume_map.mrc #1' Error processing trigger "remove models": 'cryosparc_P11_J33_004_volume_map.mrc #1': KeyError: 'cryosparc_P11_J33_004_volume_map.mrc #1' File "/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/ui/widgets/item_chooser.py", line 255, in value return self.item_map[text] See log for complete Python traceback. Traceback (most recent call last): File "/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/triggerset.py", line 130, in invoke return self._func(self._name, data) File "/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/ui/widgets/item_chooser.py", line 287, in _items_change prev_value = self.value File "/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/ui/widgets/item_chooser.py", line 255, in value return self.item_map[text] KeyError: 'cryosparc_P11_J33_004_volume_map.mrc #1' Error processing trigger "remove models": 'cryosparc_P11_J33_004_volume_map.mrc #1': KeyError: 'cryosparc_P11_J33_004_volume_map.mrc #1' File "/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/ui/widgets/item_chooser.py", line 255, in value return self.item_map[text] See log for complete Python traceback. OpenGL version: 4.1 INTEL-12.9.22 OpenGL renderer: Intel(R) Iris(TM) Plus Graphics 650 OpenGL vendor: Intel Inc.
Change History (7)
comment:1 by , 6 years ago
Cc: | added |
---|---|
Owner: | set to |
Platform: | → all |
Project: | → ChimeraX |
Status: | new → assigned |
Summary: | ChimeraX bug report submission → Apparent race condition in remove-model trigger handling |
comment:2 by , 6 years ago
Cc: | added; removed |
---|---|
Owner: | changed from | to
This seems like a bug in class ModelMenuButton in chimerax.ui.widgets. The Segger code is simply calling using "menu.value" and it raises an error. Surely that has to always work, possibly returning None?
comment:3 by , 6 years ago
Description: | modified (diff) |
---|
The menu is waiting to update its state using the same trigger you're using. I'm not sure it _can_ work if you use it between the time the model closes and it receives the 'model closed' trigger if it was showing the closed model as the menu choice. I'll look into it.
comment:4 by , 6 years ago
Any theories about how to reproduce this? I tried segmenting a map, then closing just the segmentation and also closing everything, but no dice.
comment:5 by , 6 years ago
I don't think this error has anything to do with Segger. It is simply in a model closed trigger asking for a model menu value, and probably the ordering of the model close triggers firing is the key factor. I don't understand the item_chooser.py code but I see that ItemsGenerator._item_names() computes the item_map dictionary that the dictionary that eventually gets a key error. It doesn't seem surprising given that the menu text and the item_map dictionary are not updated together -- of course they are going to sometimes be out of sync. So I would think either the item_chooser.py code has to defend against the menu text and item_map being out of sync with each other (and maybe return None as the value in that case), or the code needs reworking so that the item_map always exactly corresponds to the menu text -- ie. both are changed in the same routine, so they are guaranteed to be in sync. I don't know what design is better.
comment:6 by , 6 years ago
I removed the unnecessary code in the Segger model close callback that was triggering this error.
comment:7 by , 6 years ago
Component: | Unassigned → General Controls |
---|---|
Priority: | normal → minor |
Status: | assigned → accepted |
Though in a ideal world it would be nice if the model menu didn't throw an error in this situation, no solution is perfect. Options include:
1) Throw ValueError
2) Return the "current value" i.e. the closed model
3) Detect that the menu is in an inconsistent state, update it and return the updated value. Suppress the "value changed" signal until the menu itself receives the "model closed" trigger.
They all have their problems. The "solution" is to not touch the menu during a "model closed" trigger (since it will update itself), but there could be scenarios where this is not practical. Will wait to do something until there is second case that provides some guidance as to which option is most useful. The current case is easily dealt with by some reworking of the SeggerX code.
In the interim, will document that the menu should not be changed/queried during a "model closed" trigger handler.
I _think_ you have to change your code to delay your processing enough to allow the menu to update itself. I haven't looked at your code, but if what you're trying to do is handle the case where the closed model was the one chosen in the menu, you should get a callback from the menu that the value has changed once it processes its handler.