Question

I've got a rails development environment running in DigitalOcean on Ubuntu 12.04, but my WEBrick process keeps getting "killed" after a couple of hours. I haven't been able to find any settings or configuration that would cause this.

Example Console Ouput:

user@machinename:~/git/app$ rails s
=> Booting WEBrick
=> Rails 3.2.13 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2014-01-05 09:14:29] INFO  WEBrick 1.3.1
[2014-01-05 09:14:29] INFO  ruby 2.0.0 (2013-11-22) [x86_64-linux]
[2014-01-05 09:14:29] INFO  WEBrick::HTTPServer#start: pid=23452 port=3000


Started GET "/" for x.x.x.x at 2014-01-05 09:14:37 +0000
Processing by FunController#welcome as HTML
...

The server and app run just fine when I'm using it. But, at some point, my server will quit working. And, I'll look at the console to see this output from WEBrick:

Killed

And kick me back out to the shell. Any ideas what is causing this?

Was it helpful?

Solution

It runs out of memory. The linux kernel kills it. Droplets don't come with any 'swap' by default, so when the memory gets full, it kills a process or won't let you start a new one. Kinda crazy.

Here's an article walking you through adding a swapfile:

https://www.digitalocean.com/community/articles/how-to-add-swap-on-ubuntu-12-04

Note: I still had some problems with compiler processes being 'killed' even after adding a swapfile when 'swappiness' was set to 0. Upping it to 20 fixed the problem.

Note2: You really shouldn't use webrick in production as others have mentioned in the comments. Still, a question is a question :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top