Rails 3.0 Internal Server Error - Not Enough Space

Hi,

I have upgraded my project from rails 2.3.4 (ruby 186) to rails 3.0
(ruby 187).

For some of the controllers I am getting following error on the
frontend:

Internal Server Error
Not enough space
WEBrick/1.3.1 (Ruby/1.8.7/2010-12-23) at localhost:3000

Rails Console:

F:/waftt/app/controllers/reports_controller.rb:147: warning: don’t put
space bef
ore argument parentheses
[2011-04-13 20:27:35] ERROR Errno::ENOMEM: Not enough space
c:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.1/lib/rails/rack/log_tail
er.rb:25:in write' c:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.1/lib/rails/rack/log_tail er.rb:25:inprint’
c:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.1/lib/rails/rack/log_tail
er.rb:25:in tail!' c:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.1/lib/rails/rack/log_tail er.rb:15:incall’
c:/Ruby187/lib/ruby/gems/1.8/gems/rack-1.2.1/lib/rack/content_length.rb:
13:in call' c:/Ruby187/lib/ruby/gems/1.8/gems/rack-1.2.1/lib/rack/handler/webrick.rb :52:inservice’
c:/Ruby187/lib/ruby/1.8/webrick/httpserver.rb:104:in service' c:/Ruby187/lib/ruby/1.8/webrick/httpserver.rb:65:inrun’
c:/Ruby187/lib/ruby/1.8/webrick/server.rb:173:in start_thread' c:/Ruby187/lib/ruby/1.8/webrick/server.rb:162:instart’
c:/Ruby187/lib/ruby/1.8/webrick/server.rb:162:in start_thread' c:/Ruby187/lib/ruby/1.8/webrick/server.rb:95:instart’
c:/Ruby187/lib/ruby/1.8/webrick/server.rb:92:in each' c:/Ruby187/lib/ruby/1.8/webrick/server.rb:92:instart’
c:/Ruby187/lib/ruby/1.8/webrick/server.rb:23:in start' c:/Ruby187/lib/ruby/1.8/webrick/server.rb:82:instart’
c:/Ruby187/lib/ruby/gems/1.8/gems/rack-1.2.1/lib/rack/handler/webrick.rb
:13:in run' c:/Ruby187/lib/ruby/gems/1.8/gems/rack-1.2.1/lib/rack/server.rb:213:in
start’
c:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.1/lib/rails/commands/serv
er.rb:65:in start' c:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.1/lib/rails/commands.rb:3 0 c:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.1/lib/rails/commands.rb:2 7:intap’
c:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.1/lib/rails/commands.rb:2
7
script/rails:6:in `require’
script/rails:6

I have checked the disk space and it is more than 20G free. What could
be the issue? Does anybody know about any workaround ?

Thanks,
Payal

On Wed, Apr 13, 2011 at 11:37 PM, Payal P. [email protected]
wrote:

[2011-04-13 20:27:35] ERROR Errno::ENOMEM: Not enough space
Have you checked to make sure the host or virtual machine you are
running on has sufficient RAM? ENOMEM could indicate RAM starvation.

  • Max

On 14 April 2011 04:37, Payal P. [email protected] wrote:

WEBrick/1.3.1 (Ruby/1.8.7/2010-12-23) at localhost:3000

Rails Console:

F:/waftt/app/controllers/reports_controller.rb:147: warning: don’t put
space bef
ore argument parentheses

I suggest you correct the code to remove this warning, just in case it
is confusing the parser. You have a space after a function name
before the ‘(’ on the indicated line. It probably won’t affect the
out of memory error but it is worth doing first. My rule is to always
fix the errors/warnings I understand before worrying about the ones I
don’t.

Colin

Max S. wrote in post #992663:

On Wed, Apr 13, 2011 at 11:37 PM, Payal P. [email protected]
wrote:

[2011-04-13 20:27:35] ERROR Errno::ENOMEM: Not enough space
Have you checked to make sure the host or virtual machine you are
running on has sufficient RAM? ENOMEM could indicate RAM starvation.

  • Max

Hi Max,

Do you have any pointers to increase RAM memory allocation to rails
server? Like one can do in WebLogic or Apache webservers ?

Thanks,
Payal

Hi,

I solved this bug.

Actually this was an Window XP and ruby 187 issue. The rails console
executes on Windows command prompt. The command prompt had some
limitations on String limit to be displayed on the cmd console.

The fix was as follows:

class String
def to_2d_array(value)
unpack(“a#{value}”*((size/value)+((size%value>0)?1:0)))
end
end

class << $stdout; alias old_write write; def write a;
a.to_s.to_2d_array(1024).each{|little| old_write little}; end; end

Thanks to Roger P. for http://redmine.ruby-lang.org/issues/show/1063

Thanks,
Payal