Topic: Cannot Boot WEBrick: "WARN TCPServer 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...

Re: Cannot Boot WEBrick: "WARN TCPServer Error: Address already in use "

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 -9 is separate from the pid)
Et Voila!
Problem solved, phantom connection is destroyed.

Now, let's go back to work.

Re: Cannot Boot WEBrick: "WARN TCPServer Error: Address already in use "

I had the same issue, and this didnt work as described (with webrick on rails 3 on a mac) - the lsof didnt return a result like shown. I used:

lsof | grep IPv4

and found a line with :


ruby 6205 myusername IPv4

which I then kill -9'ed.

Re: Cannot Boot WEBrick: "WARN TCPServer Error: Address already in use "

If you get that error again, you can specify a different port number using "-p xxx" where xxx is the port number.

Re: Cannot Boot WEBrick: "WARN TCPServer Error: Address already in use "

You can use an option with the lsof command to make things easier:

lsof -iTCP:3000

Re: Cannot Boot WEBrick: "WARN TCPServer Error: Address already in use "

The solutions about work well to solve the problem.

Here's a tip to prevent it:  Shut webrick down using CTRL-C instead of CTRL-Z.  That was my mistake.

Re: Cannot Boot WEBrick: "WARN TCPServer Error: Address already in use "

yeah,just CTRL-C or exit the terminal and restart it))))))))

Re: Cannot Boot WEBrick: "WARN TCPServer Error: Address already in use "

oh thanks for shortcut keys which will helpful for me.

Re: Cannot Boot WEBrick: "WARN TCPServer Error: Address already in use "

I get the same error exactly but on mac ... any help?

Re: Cannot Boot WEBrick: "WARN TCPServer Error: Address already in use "

use the same think above with other port number in terminal.

Re: Cannot Boot WEBrick: "WARN TCPServer Error: Address already in use "

dalia wrote:

I get the same error exactly but on mac ... any help?

Open Activity Monitor, select 'All Processes' from the dropdown and filter the list using 'ruby'. Then click the huge red Quit button and you're done.

Note: IRB/rails console processes are listed as well so procede with caution.

Re: Cannot Boot WEBrick: "WARN TCPServer Error: Address already in use "

I cannot get WEBrick to boot anymore

Re: Cannot Boot WEBrick: "WARN TCPServer Error: Address already in use "

I had the same issue