Page MenuHomePhabricator

[WorkBench] Segmentation fault when "Close Project" is invoked and QmitkDataStorageComboBox widget is in UI
Open, Unbreak Now!Public


Workbench will crash when "Close Project" is called in conjunction with QmitkDataStorageComboBox being present in any plugin/tool (eg. nnUNet).

Sample workflow to replicate (Ubuntu only):

  1. Load any image, goto Segmentation View
  2. Click nnUNet.
  3. Select "Multi Modal" checkbox -> a QmitkDataStorageComboBox appears.
  4. Close Project

This leads to Segmentation fault and workbench crashes immediately.

Event Timeline

a178n triaged this task as High priority.Apr 11 2022, 5:46 PM
a178n created this task.

After some analysis with @kalali, it looks like there is some kind of race condition(?) happening while, Removing nodes by the mitk::DataStorage Vs QmitkDataStorageComboBox destructor.

  1. Are both processes asynchronous, one removing the node before the other?
  2. Is QmitkDataStorageComboBox used elsewhere to check and replicate the bug?
kalali moved this task from Backlog to In candidates on the MITK (v2023.04) board.
floca moved this task from In candidates to Segmentation on the MITK (v2023.04) board.

Now with the preferences moved to micro services, we can move the selection widget T29027 and then use them also here.

We talked about this task in our meeting today and concluded that we will migrate the DataStorageComboBox in our code to the SingleSelectionWidget and even deprecate the DataStorageComboBox.

floca raised the priority of this task from High to Unbreak Now!.Mar 24 2023, 8:18 PM

@a178n can you take care of it?

Sure. I will replace the current QmitkDataStorageComboBox widget to the newly moved NodeSelectionWidget.

Which class try to acces an invalid pointer?

It is a wild shot. But could be that it is because you do not explictly delete your modality widgets on tool destruction/deactivation, if I see it correctly. Therefor they are destrayed when Qt cleans up through parents. But in that case the state of the whole application might be not defined any more and the events could go to nirvana. May be that is the reason.
Try to test what happens when you always clean your modalities when the tool gets deactivated or deleted.

Hi Ralf,
I tried explicitly deleting widget objects but no difference. The destructor of QmitkSingleNodeSelectionWidget ie. QmitkAbstractNodeSelectionWidget::~QmitkAbstractNodeSelectionWidget finishes without issues for every widget present.
It has something to do the MessageDelegates and listeners. I don't know how to explain but I have found a way to "fix" the issue.
When I try to explicitly prevent adding Node Events namely, AddListener & RemoveListener for QmitkSingleNodeSelectionWidget object in the nnUNet tool GUI, the problem of crashing goes away! It works.
That probably means, the DataStorage object is having hanging ghost listeners which causes the crash. (But it doesn't make sense because ~QmitkAbstractNodeSelectionWidget is suppose to remove them explicitly).
My "fix" is in D793 - maybe it rings a bell.

Deleted branch from rMITK MITK: feature/T29130-nnunet-widget-change.

Is this still an open thing?

yes, issue exists the last time I tested.