Rails server Error:Address already in use

Hi,

For some reason I cannot get WEBrick to boot anymore. I installed and used Eclipse yesterday and all was working fine but today I m getting this:

$ ruby script/server
=> Booting WEBrick...
=> Rails application started on http://127.0.0.1:3000
=> Ctrl-C to shutdown server; call with --help for options
[2008-03-09 12:00:40] INFO  WEBrick 1.3.1
[2008-03-09 12:00:40] INFO  ruby 1.8.5 (2006-08-25) [i486-linux]
[2008-03-09 12:00:40] WARN  TCPServer Error: Address already in use - bind(2)
/usr/lib/ruby/1.8/webrick/utils.rb:73:in `initialize': Address already in use - bind(2) (Errno::EADDRINUSE)
        from /usr/lib/ruby/1.8/webrick/utils.rb:73:in `new'
        from /usr/lib/ruby/1.8/webrick/utils.rb:73:in `create_listeners'
        from /usr/lib/ruby/1.8/webrick/utils.rb:70:in `each'
        from /usr/lib/ruby/1.8/webrick/utils.rb:70:in `create_listeners'
        from /usr/lib/ruby/1.8/webrick/server.rb:75:in `listen'
        from /usr/lib/ruby/1.8/webrick/server.rb:63:in `initialize'
        from /usr/lib/ruby/1.8/webrick/httpserver.rb:24:in `initialize'
        from ./script/../config/../vendor/rails/railties/lib/webrick_server.rb:58:in `new'
         ... 6 levels...
        from ./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:496:in `require'
        from ./script/../config/../vendor/rails/railties/lib/commands/server.rb:39
        from script/server:5:in `require'
        from script/server:5
Any help appreciated...

OK!Problem Solved:

Linux solution:

In console do:

lsof|grep 3000
this will give you a line starting with:

ruby   6205   adam   4u  IPv4

take the number in second position (6205 in this case) and in console do:

kill -9 6205

(note-9isseparatefromthepid)

EtVoila!

Problem solved, phantom connection is destroyed.

Now, let's go back to work.

相关推荐