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

Jekyll worked fine for me a few weeks ago, but now it suddenly causes the following error:

TCPServer Error: Address already in use - bind(2) INFO WEBrick::HTTPServer#start: pid=7300 port=4000 % lsof -i :4000 <fetches nothing> 

Despite the fact that nothing is being done on the port. The following 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 conclusion

  % 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 that the address is not used, and jekyll probably breaks for some other reason, but throws this error. What are my options? I also tried reinstalling.

+87
ruby jekyll
Apr 21 2018-12-21T00:
source share
7 answers

Enter this into your terminal to find out the PID of the process that uses port 3000:

 $ lsof -wni tcp:3000 

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

 $ kill -9 PID 
+215
Oct 21 '12 at 19:29
source share

I was not qualified to leave comments. So I added a new answer.

I ran into this problem on Mac OS X 10.10.3. And I have never installed / used Jekyll before. I could not start the jekyll server with a default port number of 4000. The reason was that the port was the same as the one used by NoMachine. FROM

 $ sudo lsof -wni tcp:4000 

Note. Running this command without sudo will lead to output.

I saw this output:

 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME nxd 449 nx 3u IPv4 0x8d22************ 0t0 TCP *:terabase (LISTEN) nxd 449 nx 4u IPv6 0x8d22************ 0t0 TCP *:terabase (LISTEN) 

Port 4000 was occupied by nxd , which was started by the NoMachine process. As well as

 $ sudo kill -9 449 

will not work because the NoMachine nxd process will continue to restart with the new PID.

Therefore, I had to either:

  • Changed my jekyll server port on _config.yml to another, saved. I _config.yml line below to _config.yml and it worked.

    port: 3000 # change server port to 3000

or

  • Changed the default NoMachine nMD port, or Remove NoMachine
+16
Jun 16 '15 at 14:53
source share

Ctrl-Z does not end the program, but pauses it and sends it to the background. You can resume the program with the "fg" command. To finish it, use Ctrl-C .

The actual error message seems fictitious and may be ignored. I get the same "address in use" error message, but jekyll works fine in the expected port.

+10
Nov 14 '12 at 9:23
source share

I recently met this issue.

I tried the whole method mentioned above and even restarted my computer, but still could not solve it !!! Then I uninstalled jekyll and installed the new version, it just worked.

gem uninstall jekyll & gem install jekyll (maybe you need superuser privilege).

If you are really annoyed by such errors, this sb method is worth a try ...

+4
Sep 19 '13 at 7:15
source share

work

in /_site run: python -m SimpleHTTPServer 8080

0
Mar 24 '14 at 4:14
source share

Make sure that you do not have another terminal in which you are already using the server. If so, do CTRL-C to shut down the server and this will release the port / address.

0
Jan 27 '15 at 4:22
source share

First you need to find the PID of the process that uses port 3000:

  $ps -ef 

Exit:

 1003 4953 2614 0 08:51 pts/0 00:00:00 -bash 1003 5634 1 0 08:56 pts/0 00:00:00 spring server | moviestore | started 2 hours ago 1003 5637 5634 0 08:56 ? 00:00:01 spring app | moviestore | started 2 hours ago | development mode 1003 6078 4953 0 09:03 pts/0 00:00:03 puma 3.6.0 (tcp://localhost:3000) [moviestore] 1003 6117 2614 0 09:03 pts/1 00:00:00 -bash root 6520 2 0 09:57 ? 00:00:00 [kworker/u8:2] root 6936 1225 0 11:09 ? 00:00:00 [lightdm] <defunct> 1003 7084 1 0 11:09 ? 00:00:00 /usr/bin/python /usr/share/apport/apport-gtk 1003 7475 1 0 11:10 ? 00:00:00 /usr/bin/python /usr/share/apport/apport-gtk root 8739 1225 1 11:29 tty8 00:00:11 /usr/bin/X :1 -auth /var/run/lightdm/root/:1 -nolisten tcp vt8 -novtswitch root 8853 1225 0 11:29 ? 00:00:00 lightdm --session-child 13 22 1002 8943 1 0 11:30 ? 00:00:00 /usr/bin/gnome-keyring-daemon --daemonize --login 1002 8954 8853 0 11:30 ? 00:00:00 gnome-session --session=ubuntu 1002 8992 8954 0 11:30 ? 00:00:00 /usr/bin/ssh-agent /usr/bin/dbus-launch --exit-with-session gnome-session --session=ubuntu 1002 8995 1 0 11:30 ? 00:00:00 /usr/bin/dbus-launch --exit-with-session gnome-session --session=ubuntu 1002 8996 1 0 11:30 ? 00:00:00 //bin/dbus-daemon --fork --print-pid 5 --print-address 7 --session 1002 9007 8954 0 11:30 ? 00:00:00 /usr/lib/gnome-settings-daemon/gnome-settings-daemon 1002 9015 1 0 11:30 ? 00:00:00 /usr/lib/gvfs/gvfsd 1002 9018 8954 1 11:30 ? 00:00:07 compiz 1002 9021 1 0 11:30 ? 00:00:00 /usr/lib/x86_64-linux-gnu/gconf/gconfd-2 1002 9028 8954 0 11:30 ? 00:00:00 /usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1 1002 9029 8954 0 11:30 ? 00:00:01 nautilus -n 1002 9030 8954 0 11:30 ? 00:00:00 /usr/lib/gnome-settings-daemon/gnome-fallback-mount-helper 1002 9031 8954 0 11:30 ? 00:00:00 nm-applet 1002 9032 8954 0 11:30 ? 00:00:02 /opt/mTrac/mTrac 1002 9033 8954 0 11:30 ? 00:00:00 bluetooth-applet 1002 9045 9032 0 11:30 ? 00:00:00 /opt/mTrac/mTrac --type=zygote --no-sandbox 1002 9050 1 0 11:30 ? 00:00:00 /usr/lib/gvfs/gvfs-gdu-volume-monitor 1002 9054 1 0 11:30 ? 00:00:00 /usr/bin/pulseaudio --start --log-target=syslog 1002 9057 1 0 11:30 ? 00:00:00 /usr/lib/gvfs/gvfs-gphoto2-volume-monitor 1002 9062 1 0 11:30 ? 00:00:00 /usr/lib/gvfs/gvfs-afc-volume-monitor 

here you can see:

 1003 6078 4953 0 09:03 pts/0 00:00:03 puma 3.6.0 (tcp://localhost:3000) [moviestore] 

localhost: 3000 have pid: 6078

kill this process

 $sudo kill 6078 

then run

 $rails s 
0
Aug 29 '16 at 6:23
source share



All Articles