# Julia falling asleep during optimization (blackboxoptim)

**URL:** https://discourse.julialang.org/t/julia-falling-asleep-during-optimization-blackboxoptim/18135
**Category:** General Usage
**Tags:** optimization
**Created:** [November 29, 2018, 11:22am UTC](https://discourse.julialang.org/t/julia-falling-asleep-during-optimization-blackboxoptim/18135 "2018-11-29T11:22:20Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![davidzentlermunro](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/davidzentlermunro/32/5967_2.png) [@davidzentlermunro](https://discourse.julialang.org/u/davidzentlermunro)
#### Post date: [November 29, 2018, 11:22am UTC](https://discourse.julialang.org/t/julia-falling-asleep-during-optimization-blackboxoptim/18135/1 "2018-11-29T11:22:20Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)
#### Post date: [November 29, 2018, 11:44am UTC](https://discourse.julialang.org/t/julia-falling-asleep-during-optimization-blackboxoptim/18135/2 "2018-11-29T11:44:03Z")

</div>

> [@davidzentlermunro](#):
>
> the code inexplicably pauses

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

> [@davidzentlermunro](#):
>
> Any ideas what’s happening?

Please make an MWE.

> [@Please read: make it easier to help you](https://discourse.julialang.org/t/psa-make-it-easier-to-help-you/14757):
>
> Welcome to the Julia Discourse! We are enthusiastic about helping Julia programmers, both beginner and experienced. This public service announcement (PSA) outlines best practices when asking for help. Following these points makes it easier for us to help you and more likely you’ll get a prompt, useful answer. Keywords are highlighted to make it easier to refer to specific points. Choose a descriptive title that captures the key part of your question, eg “plots with multiple axes” instead of …

---

<div class="post-metadata">

### Author: ![sdanisch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdanisch/32/1406_2.png) [@sdanisch](https://discourse.julialang.org/u/sdanisch)
#### Post date: [November 29, 2018, 11:50am UTC](https://discourse.julialang.org/t/julia-falling-asleep-during-optimization-blackboxoptim/18135/3 "2018-11-29T11:50:27Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Ajaychat3](https://avatars.discourse-cdn.com/v4/letter/a/ecd19e/32.png) [@Ajaychat3](https://discourse.julialang.org/u/Ajaychat3)
#### Post date: [November 29, 2018, 11:54am UTC](https://discourse.julialang.org/t/julia-falling-asleep-during-optimization-blackboxoptim/18135/4 "2018-11-29T11:54:25Z")

</div>

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

---

<div class="post-metadata">

### Author: ![davidzentlermunro](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/davidzentlermunro/32/5967_2.png) [@davidzentlermunro](https://discourse.julialang.org/u/davidzentlermunro)
#### Post date: [November 29, 2018, 2:40pm UTC](https://discourse.julialang.org/t/julia-falling-asleep-during-optimization-blackboxoptim/18135/5 "2018-11-29T14:40:10Z")

</div>

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 🤔

---

<div class="post-metadata">

### Author: ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)
#### Post date: [November 29, 2018, 2:47pm UTC](https://discourse.julialang.org/t/julia-falling-asleep-during-optimization-blackboxoptim/18135/6 "2018-11-29T14:47:42Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![greg\_plowman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/greg_plowman/32/8100_2.png) [@greg\_plowman](https://discourse.julialang.org/u/greg_plowman)
#### Post date: [November 29, 2018, 10:40pm UTC](https://discourse.julialang.org/t/julia-falling-asleep-during-optimization-blackboxoptim/18135/7 "2018-11-29T22:40:16Z")

</div>

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

[http://www.zhornsoftware.co.uk/caffeine/](http://www.zhornsoftware.co.uk/caffeine/)

---

<div class="post-metadata">

### Author: ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)
#### Post date: [November 29, 2018, 10:42pm UTC](https://discourse.julialang.org/t/julia-falling-asleep-during-optimization-blackboxoptim/18135/8 "2018-11-29T22:42:44Z")

</div>

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

---

<div class="post-metadata">

### Author: ![davidzentlermunro](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/davidzentlermunro/32/5967_2.png) [@davidzentlermunro](https://discourse.julialang.org/u/davidzentlermunro)
#### Post date: [December 7, 2018, 10:39am UTC](https://discourse.julialang.org/t/julia-falling-asleep-during-optimization-blackboxoptim/18135/9 "2018-12-07T10:39:50Z")

</div>

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

---

<div class="post-metadata">

### Author: ![davidzentlermunro](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/davidzentlermunro/32/5967_2.png) [@davidzentlermunro](https://discourse.julialang.org/u/davidzentlermunro)
#### Post date: [December 14, 2018, 11:20am UTC](https://discourse.julialang.org/t/julia-falling-asleep-during-optimization-blackboxoptim/18135/10 "2018-12-14T11:20:12Z")

</div>

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

---

<div class="post-metadata">

### Author: ![johnh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnh/32/3615_2.png) [@johnh](https://discourse.julialang.org/u/johnh)
#### Post date: [December 14, 2018, 2:29pm UTC](https://discourse.julialang.org/t/julia-falling-asleep-during-optimization-blackboxoptim/18135/11 "2018-12-14T14:29:19Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)
#### Post date: [December 14, 2018, 5:57pm UTC](https://discourse.julialang.org/t/julia-falling-asleep-during-optimization-blackboxoptim/18135/12 "2018-12-14T17:57:37Z")

</div>

> [@davidzentlermunro](#):
>
> Any further thoughts on this: seems like a serious flaw that code stops running inexplicably.

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.

---

<div class="post-metadata">

### Author: ![jpsamaroo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jpsamaroo/32/46804_2.png) [@jpsamaroo](https://discourse.julialang.org/u/jpsamaroo)
#### Post date: [December 14, 2018, 6:54pm UTC](https://discourse.julialang.org/t/julia-falling-asleep-during-optimization-blackboxoptim/18135/13 "2018-12-14T18:54:55Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![bennedich](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bennedich/32/4894_2.png) [@bennedich](https://discourse.julialang.org/u/bennedich)
#### Post date: [December 14, 2018, 8:26pm UTC](https://discourse.julialang.org/t/julia-falling-asleep-during-optimization-blackboxoptim/18135/14 "2018-12-14T20:26:20Z")

</div>

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](https://stackoverflow.com/questions/33883530/why-is-my-command-prompt-freezing-on-windows-10) for an example.

---

<div class="post-metadata">

### Author: ![Ajaychat3](https://avatars.discourse-cdn.com/v4/letter/a/ecd19e/32.png) [@Ajaychat3](https://discourse.julialang.org/u/Ajaychat3)
#### Post date: [December 15, 2018, 6:13am UTC](https://discourse.julialang.org/t/julia-falling-asleep-during-optimization-blackboxoptim/18135/15 "2018-12-15T06:13:43Z")

</div>

> [@bennedich](#):
>
> quick edit” mode d

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.

---

<div class="post-metadata">

### Author: ![bernhard](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bernhard/32/2619_2.png) [@bernhard](https://discourse.julialang.org/u/bernhard)
#### Post date: [December 15, 2018, 7:20am UTC](https://discourse.julialang.org/t/julia-falling-asleep-during-optimization-blackboxoptim/18135/16 "2018-12-15T07:20:26Z")

</div>

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…
