Address already in use - bind(2) (Errno::EADDRINUSE)

After trying all things in : Ruby script/server -- Errno::EADDRINUSE - Rails - Ruby-Forum I cannot find the pid of the clogger. So, I am still having trouble clearing whatever is active on my localhost port 3000.

I can run on a different port "script/server -p 3001" . But my OC would like to have all ports on my machine clean and usable.

Below is my error - please help. Thanks!

When I try to start the server on typical 3000 port with "script/server" (using mogrel) I get:

=> Booting Mongrel => Rails 2.3.8 application starting on http://0.0.0.0:3000 => Call with -d to detach => Ctrl-C to shutdown server Exiting /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/tcphack.rb:12:in `initialize_without_backlog': Address already in use - bind(2) (Errno::EADDRINUSE)   from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/tcphack.rb:12:in `initialize'   from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:93:in `new'   from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:93:in `initialize'   from /Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/handler/mongrel.rb:10:in `new'   from /Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/handler/mongrel.rb:10:in `run'   from /Library/Ruby/Gems/1.8/gems/rails-2.3.8/lib/commands/server.rb:111   from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'   from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'   from script/server:3

Sounds like you have a stuck terminal somewhere. Have you restarted lately? Does the problem persist over a restart?

Walter

Yes. It persists after restart/shutdown.

Are you using any sort of third-party Apache handler, like Headdress or VirtualHostX, which can configure a persistent local server on a high port? What do you see if you log into your computer and open a fresh terminal and try to launch script/server from your rails root? Does your computer just start up with Mongrel running somewhere? What do you see when you open a browser and go to localhost:3000?

Walter

Not using Headdress or VirtualHostX.

I don't think I have Mongrel on any kind of autostart. But not sure.

When I open a browser and go to localhost:3000 - it just cycles in a load without any page resolve (error or otherwise)

In trying : $: sudo railsapp/script/server

I got:

=> Booting Mongrel => Rails 2.3.8 application starting on http://0.0.0.0:3000 => Call with -d to detach => Ctrl-C to shutdown server Exiting /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/tcphack.rb:12:in `initialize_without_backlog': Address already in use - bind(2) (Errno::EADDRINUSE)   from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/tcphack.rb:12:in `initialize'   from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:93:in `new'   from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:93:in `initialize'   from /Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/handler/mongrel.rb:10:in `new'   from /Library/Ruby/Gems/1.8/gems/rack-1.1.0/lib/rack/handler/mongrel.rb:10:in `run'   from /Library/Ruby/Gems/1.8/gems/rails-2.3.8/lib/commands/server.rb:111   from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'   from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'   from bitbookr/script/server:3

You might try

lsof -i

To see which process/pid has port 3000 open. It will show up as something like:

ruby 94580 7u IPv4 0x08681274 0t0 TCP *:hbci (LISTEN)

The 94580 is the PID. The hbci is because port 3000 is used for that protocol (apparently).

On linux netstat -nap would show which processes have which ports open. Sadly -p/-o does not seem to exist on the mac version of netstat.

Thanks Vince. I am getting:

COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME launchd 1 root 9u IPv6 0x08637e20 0t0 TCP *:hbci (LISTEN) launchd 1 root 10u IPv4 0x0863cb4c 0t0 TCP *:hbci (LISTEN) launchd 1 root 20u IPv6 0x08637bb0 0t0 TCP localhost:ipp (LISTEN) launchd 1 root 21u IPv4 0x0863c740 0t0 TCP localhost:ipp (LISTEN) launchd 1 root 74u IPv6 0x08637940 0t0 TCP *:afpovertcp (LISTEN) launchd 1 root 76u IPv4 0x0863c334 0t0 TCP *:afpovertcp (LISTEN) ...

Any thoughts?

Do you have Zfone installed?

See :

For more details (not much). Other than that, I have nothing else for you.

Yes, I do - it's terrible. This has got to be the issue. Thanks so much!

This doesn't seem to be a specific rails problem, you know?

If you're using ubuntu look here: http://ubuntuforums.org/archive/index.php/t-183878.html

With: sudo netstat -lpnAinet you can find out which program is using port 3000

Thanks Walter and Vince. And for those playing at home with same problem:

sudo launchctl remove phil-zimmermann.zfoned

This did the trick! Would have never got this without the help. Thanks Guys!

And of course to remove it permanently: sudo rm -rf /Library/LaunchDaemons/com.phil-zimmermann.zfoned.plist