Running a rails s on my app causes an error ...rack/server.rb:340:in 'kill': Invalid argument (Errno::EINVAL). This automatically stops the app from working.

I'm using InstantRails and running rails 3.2.13 on WEBrick for development, unfortunately it doesn't seem tow work for this specific app. The exact error is as listed below:

D:\rails_apps\********>rails s
=> Booting WEBrick
=> Rails 3.2.13 application starting in development on
=> Call with -d to detach
=> Ctrl-C to shutdown server
D:/InstantRails3/ruby/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:340:in 'kill': Invalid argument (Errno::EINVAL)
        from D:/InstantRails3/ruby/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:340:in 'pidfile_process_status'
        from D:/InstantRails3/ruby/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:327:in 'check_pid!'
        from D:/InstantRails3/ruby/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:250:in 'start'
        from D:/InstantRails3/ruby/lib/ruby/gems/1.9.1/gems/railties-3.2.13/lib/rails/commands/server.rb:70:in 'start'
        from D:/InstantRails3/ruby/lib/ruby/gems/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:55:in 'block in <top (required)>
        from D:/InstantRails3/ruby/lib/ruby/gems/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:50:in 'tap'
        from D:/InstantRails3/ruby/lib/ruby/gems/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:50:in '<top (required)>'
        from script/rails:6:in 'require'
        from script/rails:6:in '<main>'



Some online tutorials says to use a different server for development such as mongrel but since I don't want to install another server just for development, I tried looking for another solution.

One of the things I noticed is that everytime you run rails s a file called is created inside the tmp/pids directory. This file is then removed after the server shuts down properly.

This file contains which I believe (correct me if I am wrong) the process ID of the web server. There are cases when the process dies and the file still remains, it usually happens during power failure or just a sudden shut down of the system.

With that remaining and the process been killed, running the server would cause error since the system tries to kill first the process that doesn't seem to be existing. To resolve it, simply delete the file ( and re-run the system.

This should now work.

No comments :

Post a Comment