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

948 views
Skip to first unread message

amrit pal pathak

unread,
May 18, 2011, 5:26:03 AM5/18/11
to Ruby on Rails: Talk
I made a new rails app and when i started the server ,it gave
following error message.


=> 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
/usr/lib/ruby/1.8/mongrel/tcphack.rb:12:in
`initialize_without_backlog': Address already in use - bind(2)
(Errno::EADDRINUSE)
from /usr/lib/ruby/1.8/mongrel/tcphack.rb:12:in `initialize'
from /usr/lib/ruby/1.8/mongrel.rb:93:in `new'
from /usr/lib/ruby/1.8/mongrel.rb:93:in `initialize'
from /var/lib/gems/1.8/gems/rack-1.1.0/lib/rack/handler/mongrel.rb:
10:in `new'
from /var/lib/gems/1.8/gems/rack-1.1.0/lib/rack/handler/mongrel.rb:
10:in `run'
from /var/lib/gems/1.8/gems/rails-2.3.8/lib/commands/server.rb:111
from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
from script/server:3



Please help to resolve.

Thanks.

Ankit Varshney

unread,
May 18, 2011, 5:36:14 AM5/18/11
to rubyonra...@googlegroups.com
Hi Amrit,

You cannot run two application on the same port. One of your application is already running using port 3000. And you are trying to run another application on the same port.

If you want to run another application, then use the following command to do that:

rub script/server -p 3001

where 3001 is the port number. You choose any other ports also.


Ankit



--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.


Peter De Berdt

unread,
May 18, 2011, 5:37:07 AM5/18/11
to rubyonra...@googlegroups.com
You already have a server running on port 3000. Probably another Webrick server you started earlier in a different terminal window. It even says so: Address already in use. I don't see how it could be any more obvious.


Best regards


Peter De Berdt


amrit pal pathak

unread,
May 20, 2011, 10:03:07 AM5/20/11
to Ruby on Rails: Talk


On May 18, 5:37 am, Peter De Berdt <peter.de.be...@pandora.be> wrote:
> On 18 May 2011, at 11:26, amrit pal pathak wrote:
>
>
>
>
>
>
>
>
>
> > I made a new rails app and when i started the server ,it gave
> > following error message.
>
> > => Booting Mongrel
> > => Rails 2.3.8 application starting onhttp://0.0.0.0:3000
> > => Call with -d to detach
> > => Ctrl-C to shutdown server
> > Exiting
> > /usr/lib/ruby/1.8/mongrel/tcphack.rb:12:in
> > `initialize_without_backlog': Address already in use - bind(2)
> > (Errno::EADDRINUSE)
> >    from /usr/lib/ruby/1.8/mongrel/tcphack.rb:12:in `initialize'
> >    from /usr/lib/ruby/1.8/mongrel.rb:93:in `new'
> >    from /usr/lib/ruby/1.8/mongrel.rb:93:in `initialize'
> >    from /var/lib/gems/1.8/gems/rack-1.1.0/lib/rack/handler/mongrel.rb:
> > 10:in `new'
> >    from /var/lib/gems/1.8/gems/rack-1.1.0/lib/rack/handler/mongrel.rb:
> > 10:in `run'
> >    from /var/lib/gems/1.8/gems/rails-2.3.8/lib/commands/server.rb:111
> >    from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in
> > `gem_original_require'
> >    from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
> >    from script/server:3
>
> > Please help to resolve.
>
> You already have a server running on port 3000. Probably another  
> Webrick server you started earlier in a different terminal window. It  
> even says so: Address already in use. I don't see how it could be any  
> more obvious.
Is there any way to check,how many ports are already in use,so
that i can stop the application which are already running on those.?

Thanks

Tom Meinlschmidt

unread,
May 20, 2011, 10:09:13 AM5/20/11
to rubyonra...@googlegroups.com
on linux - "lsof | grep -i ruby"

tom

> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

--
Maxwell Render CZ
Autorizovany distributor Maxwell renderu pro Ceskou republiku

Pavel

unread,
Dec 8, 2011, 6:27:38 PM12/8/11
to rubyonra...@googlegroups.com
> on linux - "lsof | grep -i ruby"

I would like to recommend:
lsof -i :3000
(given that the zombie server is running on port 3000)

and then to check a reported <PID>:
ps ax | grep <PID>

before final:
kill -QUIT <PID>

--
Posted via http://www.ruby-forum.com/.

Agu N.

unread,
Nov 24, 2013, 4:15:35 PM11/24/13
to rubyonra...@googlegroups.com
I agree with Peter De Berdt ..

Another webrick server is still running

Just close the shell and reopen it..

and then run

'rails server' again

Fahad Idrees

unread,
Nov 25, 2013, 4:02:11 AM11/25/13
to rubyonra...@googlegroups.com
you can check which process is running on that port by typing on command line

lsof -i tcp:port number and than kill that process by typing
kill -9 process#

and that start the rails server -p 3000


--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.

To post to this group, send email to rubyonra...@googlegroups.com.

Colin Law

unread,
Nov 25, 2013, 6:19:41 AM11/25/13
to rubyonra...@googlegroups.com
On 25 November 2013 09:02, Fahad Idrees <access...@gmail.com> wrote:
> you can check which process is running on that port by typing on command
> line
>
> lsof -i tcp:port number and than kill that process by typing
> kill -9 process#
>
> and that start the rails server -p 3000
>
>
> On Mon, Nov 25, 2013 at 2:15 AM, Agu N. <li...@ruby-forum.com> wrote:
>>
>> I agree with Peter De Berdt ..
>>
>> Another webrick server is still running

Did you all realise you are responding to a post from 2011?

Colin

Tamara Temple

unread,
Nov 25, 2013, 10:45:16 PM11/25/13
to rubyonra...@googlegroups.com
Gmail Random Delivery strikes again!

Reply all
Reply to author
Forward
0 new messages