populse / populse_mia

Multiparametric Image Analysis
Other
10 stars 9 forks source link

[Run step] The execution of the process mia_processes.bricks.tools.Add_Floats crashes Mia #275

Closed servoz closed 2 years ago

servoz commented 2 years ago

A fake brick was created to test the execution step of a minimal process (initially related to the #11 ticket in mia_processes). This process contains just an instantiation of traits in the constructor, nothing special in list_outputs() and only an addition in run_process_mia().. At runtime, Mia crashes with a segmentation fault:

Fatal Python error: Segmentation fault

Thread 0x00007f5ba2ffd700 (most recent call first):
  File "/usr/lib64/python3.8/threading.py", line 306 in wait
  File "/usr/lib64/python3.8/threading.py", line 558 in wait
  File "/data/Git_Projects/soma-workflow/python/soma_workflow/engine.py", line 558 in start_loop
  File "/data/Git_Projects/soma-workflow/python/soma_workflow/engine.py", line 102 in run
  File "/usr/lib64/python3.8/threading.py", line 932 in _bootstrap_inner
  File "/usr/lib64/python3.8/threading.py", line 890 in _bootstrap

Thread 0x00007f5ba37fe700 (most recent call first):
  File "/usr/lib64/python3.8/threading.py", line 306 in wait
  File "/usr/lib64/python3.8/threading.py", line 558 in wait
  File "/data/Git_Projects/soma-workflow/python/soma_workflow/schedulers/local_scheduler.py", line 291 in _iterate
  File "/data/Git_Projects/soma-workflow/python/soma_workflow/schedulers/local_scheduler.py", line 137 in loop
  File "/usr/lib64/python3.8/threading.py", line 870 in run
  File "/usr/lib64/python3.8/threading.py", line 932 in _bootstrap_inner
  File "/usr/lib64/python3.8/threading.py", line 890 in _bootstrap

Thread 0x00007f5bb0873700 (most recent call first):
  File "/data/Git_Projects/soma-workflow/python/soma_workflow/schedulers/local_scheduler.py", line 205 in poll_processes
  File "/usr/lib64/python3.8/threading.py", line 870 in run
  File "/usr/lib64/python3.8/threading.py", line 932 in _bootstrap_inner
  File "/usr/lib64/python3.8/threading.py", line 890 in _bootstrap

Current thread 0x00007f5c34511740 (most recent call first):
  File "/data/Git_Projects/populse_mia/python/populse_mia/user_interface/pipeline_manager/pipeline_manager_tab.py", line 2967 in end_progress
  File "main.py", line 591 in launch_mia
  File "main.py", line 836 in main
  File "main.py", line 1288 in <module>
Segmentation fault (core dumped)
servoz commented 2 years ago

In fact, Mia crashes with the V2 controller. With the V1 controller display, Mia does not crash ... but the output remains at 0.0. On the other hand soma_workflow indicates that the right result has been obtained: Screenshot from 2022-05-17 09-10-27

servoz commented 2 years ago

Oh I see! In fact we just have to click on the brick, after the execution, to see the right output result... I think in this case it is necessary to change the codes to make an update of the controller which does not seem to take place with the V1 controller. There is still the case of the V2 controller which makes Mia crash in this case of process.

servoz commented 2 years ago

The above error message with segmentation fault was already pointed out by @denisri on the #11 ticket of mia_processes!

denisri commented 2 years ago

Yes it's the problem I faced when trying populse/mia_processes#11, and I could not understand what's going on (I have spent like 2 days fighting with it). The crash happens:

So it really looks like a threading concurrent access problem: I suspect the value modified during the run triggers a callback somewhere, which updates the GUI from the wrong thread. But even after looking a while I could not identify it.

servoz commented 2 years ago

Oh my god, this is not far from being the most complicated type of issue to fix ...

denisri commented 2 years ago

I think I've got it ! If you can check when you have time...

servoz commented 2 years ago

Yes, you did it!!! The GUI V2 controller no longer crashes Mia. That's wonderful! I'll look to refresh the V1 GUI at the end of the run.