Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
442 views
in Technique[技术] by (71.8m points)

ruby - TCPServer Error: Address already in use - bind(2)

Jekyll was working fine for me few weeks back but now all of a sudden it gives me the following error:

TCPServer Error: Address already in use - bind(2)
INFO  WEBrick::HTTPServer#start: pid=7300 port=4000

 % lsof -i :4000
 <fetches nothing>

Even though nothing is running on the port. Below are the details:

 % jekyll --version
Jekyll 0.11.2
 % where jekyll
/home/bhaarat/.rvm/gems/ruby-1.9.2-p290/bin/jekyll
/usr/bin/jekyll
 % ruby --version
ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]
 % rvm --version
rvm 1.10.0 

Here is the output

 % jekyll --server
Configuration from /home/bhaarat/blog/omnipresent.github.com/_config.yml
Auto-regenerating enabled: /home/bhaarat/blog/omnipresent.github.com -> /home/bhaarat/blog/omnipresent.github.com/_site
[2012-04-21 13:46:40] regeneration: 38 files changed
[2012-04-21 13:46:40] INFO  WEBrick 1.3.1
[2012-04-21 13:46:40] INFO  ruby 1.9.2 (2011-07-09) [i686-linux]
[2012-04-21 13:46:40] WARN  TCPServer Error: Address already in use - bind(2)
[2012-04-21 13:46:40] INFO  WEBrick::HTTPServer#start: pid=7382 port=4000

I know the address isn't in use and jekyll is probably breaking for some other reason but throwing that error. What are my options? I've tried re-installing as well.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Type this in your terminal to find out the PID of the process that's using the 3000 port:

$ lsof -wni tcp:3000

Then, use the number in the PID column to kill the process:

$ kill -9 PID

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...