Vagrant environment randomly hangs VirtualBox VM

I like the Vagrant dev setup because of it’s simplicity and isolation. However, I’ve found it to be unreliable and am curious if anyone else is running into this?

Symptom
Within a couple minutes of starting rails and sidekiq one of my host CPUs pegs out at 100% and my vagrant ssh consoles not longer respond. Also, I cannot establish another vagrant ssh session with the discourse VM.

Resolution
The only solution I’ve found thus far is to vagrant halt the discourse machine. I then vagrant up and start rails and sidekiq again, crossing my fingers that the halt didn’t corrupt anything and that I don’t get locked up again.

I have run into this issue on multiple host machines (Unbuntu 16.04) and multiple versions of Vagrant and VirtualBox. It seems to happen regularly, but not everytime.

Repro steps:

  1. Setup new Vagrant Discourse installation per instructions
  2. Open mailcatcher, discourse, and sidekiq in host browser
  3. Log into discourse

By this point, if it’s going to lock up, the VM is already locked up. One of my host CPUs is at 100%. I can leave it like this overnight and it never recovers. The only way out is to halt and restart the machine.

I’m not even sure where to start troubleshoot this. Please share your suggestions.

I believe I’ve solved this by setting the number of CPUs to 1. I’ve been running a full day without hanging and performance seems good enough, so I’m going to call this solved.

2 Likes