# Long running process problem

**URL:** https://discourse.slicer.org/t/long-running-process-problem/25632
**Category:** Development
**Created:** [October 10, 2022, 11:16pm UTC](https://discourse.slicer.org/t/long-running-process-problem/25632 "2022-10-10T23:16:04Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![bzhu](https://avatars.discourse-cdn.com/v4/letter/b/3bc359/32.png) [@bzhu](https://discourse.slicer.org/u/bzhu)
#### Post date: [October 10, 2022, 11:16pm UTC](https://discourse.slicer.org/t/long-running-process-problem/25632/1 "2022-10-10T23:16:05Z")

</div>

I have a set of code for imaging processing that takes quite a long while to run.

If I run the code in command-line with PythonSlicer, the code completes and generates a new image.

However, when I run the code inside my Slicer extension, Slicer has a spin busy cursor for a long while and then the whole Slicer studio quits.

Just wonder if the 3d Slicer has a built-in timeout with an adjustable parameter for the timeout.

Thanks,  
Bing Zhu  
UCLA

---

<div class="post-metadata">

### Author: ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)
#### Post date: [October 11, 2022, 1:12pm UTC](https://discourse.slicer.org/t/long-running-process-problem/25632/2 "2022-10-11T13:12:43Z")

</div>

If you can reproduce this with a script you can share it will be easier for people to help.

---

<div class="post-metadata">

### Author: ![jay1987](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jay1987/32/16183_2.png) [@jay1987](https://discourse.slicer.org/u/jay1987)
#### Post date: [October 13, 2022, 7:14am UTC](https://discourse.slicer.org/t/long-running-process-problem/25632/3 "2022-10-13T07:14:35Z")

</div>

i think you can use the extension [SlicerParallelProcessing] to put the complex computation in that,and the main process listen to the sub process when it finished,that won’t cause a spin busy cursor.  
but i encount a problem when i import qt in [SlicerParallelProcessing],the sub process stop with error , i dont’t know why @pieper

---

<div class="post-metadata">

### Author: ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)
#### Post date: [October 13, 2022, 2:25pm UTC](https://discourse.slicer.org/t/long-running-process-problem/25632/4 "2022-10-13T14:25:23Z")

</div>

> [@jay1987](#):
>
> i import qt in [SlicerParallelProcessing],the sub process stop with error , i dont’t know why

ParallelProcessing uses [PythonSlicer](https://github.com/pieper/SlicerParallelProcessing/blob/master/Processes/Processes.py#L227) by default so it can communicate via stdin/stdout of the subprocess. if you have a use case that requires Qt, you could start `Slicer --no-main-window` instead, but you’d need to implement a different communication strategy since the main Slicer app doesn’t communicate via stdin/stdout (although I wish it did and perhaps we should implement that). An option for communicating a helper Slicer background process would be to run with the WebServer in either the helper or the main Slicer and passing commands and data back and forth via http.

---

<div class="post-metadata">

### Author: ![jay1987](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jay1987/32/16183_2.png) [@jay1987](https://discourse.slicer.org/u/jay1987)
#### Post date: [October 14, 2022, 12:53am UTC](https://discourse.slicer.org/t/long-running-process-problem/25632/5 "2022-10-14T00:53:35Z")

</div>

> [@pieper](#):
>
> ParallelProcessing uses [PythonSlicer](https://github.com/pieper/SlicerParallelProcessing/blob/master/Processes/Processes.py#L227) by default so it can communicate via stdin/stdout of the subprocess. if you have a use case that requires Qt, you could start `Slicer --no-main-window` instead, but you’d need to implement a different communication strategy since the main Slicer app doesn’t communicate via stdin/stdout (although I wish it did and perhaps we should implement that). An

thank you pieper,it helps me!
