Sometimes OpenSesame leaves an un-killable "zombie" process on MacOS
Occasionally, usually when switching between experiments, OpenSesame on MacOS gets into a state where it can neither launch nor be quit. I can't figure out exactly how to reproduce this state (I know, sorry!), but it happens not infrequently (maybe once a week). When in this state, the OpenSesame icon remains in the dock, although it is not usually there when the app is closed. None of the usual methods for killing a process that I know of work: I cannot force quit the app using Activity Monitor. If I do ps -az in the terminal, OpenSesame is not among the list of running processes, so I can't find a PID to kill it that way. I have tried reinitializing launchd with sudo kill -s HUP 1 but that doesn't do it. If I try to restart the computer with apple-menu -> Restart.. I get a popup that says that the computer can't restart because OpenSesame stopped it from restarting. The only solution is to hold down the power key to hard power down, and then restart. I'm using MacOS 10.15.6
Hi Ethan,
Thanks for reporting this. That sounds pretty nasty. A few questions to narrow the issue down:
- Are you running the (currently) latest version of OpenSesame, which is 3.3.3? This is important because this version includes a mechanism that should kill of zombie processes. If not then please update and report back if the issue still occurs :-)
- What happens to the OpenSesame interface exactly? Does the interface disappear completely, or does it become unresponsive?
- What do you mean exactly with 'switching between experiments'?
- I suspect that the zombie process will be called
python. When this happens, does killing allpythonprocesses make the issue go away?
Cheers! Sebastiaan
Hi Sebastian,
- Are you running the (currently) latest version of OpenSesame, which is 3.3.3? This is important because this version includes a mechanism that should kill of zombie processes. If not then please update and report back if the issue still occurs :-)
I am indeed running 3.3.3
- What happens to the OpenSesame interface exactly? Does the interface disappear completely, or does it become unresponsive?
The interface disappears completely. The only indication that something is still running is the dock icon, which no longer has the little dot that indicates that the app is running, but does not disappear from the dock, as it normally would when the app has been quit.
- What do you mean exactly with 'switching between experiments'?
Ok, I know this is the part I need to document better. I haven't narrowed it down to a reproducible behavior yet, but the habit I have developed to avoid it is to always quit OpenSesame if I have been working on one .osexp file and want to open a different .osexp file. But sometimes I forget, and things get stuck. I have not been able to reproduce it today, but I think it is somehow related to having two instances of OpenSesame running at the same time, and then quitting one of them.
- I suspect that the zombie process will be called python. When this happens, does killing all python processes make the issue go away?
I will give it a try next time it happens, and report the results :-)
Ok, I managed to get OpenSesame into this state again. I think the order of operations was:
- OpenSesame was already open
- I double-clicked on a .osexp file to open it.
- Quit OpenSesame
- Zombie state.
I tried killing all Python processes, but none of them appeared related to OpenSesame:
https://pastebin.com/wW0REwwj
Thanks, for this. I'm pinging @dschreij , who does most of the work on the Mac OS packaging.
Regarding the processes. You're grepping for Python (with an uppercase 'p'), whereas the process will be called python. So I'm still sticking with my original guess that the zombie process is called python. But we'll take it from here.
You should indeed be able to kill OpenSesame with killall python (which will take other non-related python processed down too, if there are any). I have never experienced this zombie state, but then again I always open osexp files from within OpenSesame anyway, since opening through .osexp files in Finder is broken. MacOS works with events that specify what file needs to be opened, instead of just passing the path of the file to open as a parameter to the app (as other OS's do). I have never figured out how to listen or process these events, even though I have spent considerable time trying to figure this out.
My advice here would be to steer clear from opening osexp files (or switch between osexp files) through Finder until this is fixed, but I am not giving this high priority, so it may be a while.
Thanks Daniel, I completely understand giving this low priority. I also try to only open osexp files from within OpenSesame, but sometimes I forget. Although it is probably excessive, I try to always quit OpenSesame and then relaunch it before opening a new osexp file from within OpenSesame. I have also managed to trigger this zombie state by quitting OpenSesame and then immediately relaunching it (using Alfred as a launcher). Anyway, if I get any more useful insight into either how to trigger this state, or whether killall python clears it up, I will post it. Thanks for all your work on this great software!
@ethanweed There's one thing you could try to help us out. There are a few steps, but it's not really complicated. First, you need to enable the in-process kernel for the Jupyter Console, which you can do under Preferences. The next time that you start OpenSesame, there will be two console tabs. The first one, Python (1), basically lives in the application process, and you can thus interact with OpenSesame directly by typing things there. Here, enter:
SubprocessManager.activate()
This will show a list of all OpenSesame-related processes that are currently running. If you note down the PIDs and descriptions of those processes, and then trigger the zombie state, you should be able to tell which of the processes actually becomes a zombie. And that would be super-helpful to know. Does that make sense?

@smathot Yes, it does make sense. I will report back with my findings :-)