Julia falling asleep during optimization (blackboxoptim)

When I’m running an optimization (by running a file using the include command on terminal) , I find the code inexplicably pauses and will only restart if I hit a key while in the REPL. Almost like it’s fallen asleep. I’m using blackboxoptim for the optimization. Any ideas what’s happening?

How do you determine that? Eg are you monitoring CPU utilization?

Please make an MWE.

Sounds a lot like this is the old windows hanging problem … So likely pretty hard to make an MWE :wink:

You may check the battery setting as well if there is a related sleep setting timer after X minutes.

determined by pause in production of output on REPL window (which then resumes when I hit a key). MWE proving tricky: any simple example I use doesn’t seem to replicate the problem :thinking:

I have also gotten this randomly on Windows a few times (when trying things out in a VM). Typically when doing Pkg(3) operations. Pressing a button on the keyboard makes it wake up again.

If the problem is Windows going to sleep, maybe caffeine can help:


It is not actually going to sleep, the Julia REPL just freezes and no computations are done. Like it is blocked on something.

Yep the computer isn’t going to sleep - just julia REPL.

Any further thoughts on this: seems like a serious flaw that code stops running inexplicably.

Hi. I have a dual boot machine with Windows 10 and Fedora. Coudl I help to reproduce the problem?
On the Linux side I would start by doing straces of the julia process - I’m not sure what the equivalent is in Windows.

1 Like

It is a serious flaw, but the difficulty to reproduce in combination with that not many developers are using Windows makes it hard to track down.

Someone with debug skills on Windows would have to be able to reproduce this and look into the state of the process to see what it is blocking on.

Can someone provide some example code that is known to (at least sometimes) reproduce the issue? I have a Windows 7 install that I could test this on, and I’m reasonably familiar with using a process debugger.

1 Like

One thing that could cause this behavior is the console ending up in “quick edit” mode due to a selection being made in the window. It’s super easy to do this by mistake, and it ends up freezing the entire process. I’ve seen this many times when I was working on Windows. See this post for an example.

I face the same issue quite often when accidently or otherwise I click left mouse button and then everything freezes until I click the right mouse button.

CI have run into this as well. Although I have no idea how to reproduce this.
A few times I even had several cmd windows open (say 10) running different simulations, and one or two of them would get stuck while the others would run through…