ruby server进程如何杀掉,有很多好建议
Skip to forum content
A forum for Ruby on Rails users
Index User list Register Login
You are not logged in. Please login or register.
Rails Forum - Ruby on Rails Help and Discussion Forum ? Setup and Configuration ? Cannot Boot WEBrick: "WARN TCPServer Error: Address already in use "
Pages1You must login or register to post a reply
RSS topic feed
Posts [ 6 ]
1r2d2rabeau2008-03-09 08:06:39
Passenger
Offline
Registered: 2007-11-22
Posts: 46
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...
2r2d2rabeau2008-03-09 09:32:50
Passenger
Offline
Registered: 2007-11-22
Posts: 46
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.
3rcanand2010-10-24 19:57:23
Ticketholder
Offline
Registered: 2010-04-07
Posts: 3
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.
4pash262010-10-28 12:14:40
Ticketholder
Offline
From: San Diego, CA
Registered: 2008-07-28
Posts: 5
If you get that error again, you can specify a different port number using "-p xxx" where xxx is the port number.
5baldmark2011-01-11 08:09:32
Ticketholder
Offline
Registered: 2011-01-11
Posts: 1
You can use an option with the lsof command to make things easier:
lsof -iTCP:3000
6stacyvlasits2011-02-04 16:18:28
Ticketholder
Offline
Registered: 2010-05-19
Posts: 2
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.
Posts [ 6 ]
Pages1You must login or register to post a reply
Rails Forum - Ruby on Rails Help and Discussion Forum ? Setup and Configuration ? Cannot Boot WEBrick: "WARN TCPServer Error: Address already in use "
Hosting provided by aTech Media