I've encountered a WEBrick + Rails problem & I haven't been able to find anyone else with the same issue.
I run WEBrick in my Rails app with
$ rvmsudo rails server -p 80
then I leave it in a detached screen
and log out. If I wait a few days, WEBrick stops serving requests, giving this every time someone tries to load the app:
ERROR ThreadError: can't create Thread (11)
/home/pi/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/webrick/server.rb:284:in `start'
Then when I try to stop the server and restart it with Control-C, sometimes it shows this and I have to press Control-C twice to kill it:
[2013-11-13 21:13:08] ERROR NoMethodError: undefined method `shutdown' for nil:NilClass
/home/pi/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/handler/webrick.rb:25:in `shutdown'
I tried checking whether my server has enough resources—plenty of RAM, CPU, disk space, swap, and network I/O to spare. Everything looks almost the same as when Rails is running normally (it's a really simple app).
Software & hardware details: Rails 4.0.1 with ruby 2.0.0p247 (2013-06-27 revision 41674) [armv6l-linux-eabihf] running on a Raspberry Pi with the latest Raspbian.
Source of my app is on GitHub. It's running at http://door.servebeer.com/.
Thanks in advance for your help!