简体   繁体   中英

Why do I get an error when starting ruby on rails app with mongrel_rails

Why do I get following error when trying to start a ruby on rails application with

mongrel_rails start
?

 \nC:\\RailsTest\\cookbook2>mongrel_rails start \n** WARNING: Win32 does not support daemon mode. \n** Daemonized, any open files are closed.  Look at log/mongrel.pid and log/mongr \nel.log for info. \n** Starting Mongrel listening at 0.0.0.0:3000 \nc:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../lib/mongrel/t \ncphack.rb:12:in `initialize_without_backlog': Only one usage of each socket addr \ness (protocol/network address/port) is normally permitted.  - bind(2) (Errno::EAD \nDRINUSE) \n        from c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../ \nlib/mongrel/tcphack.rb:12:in `initialize' \n        from c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../ \nlib/mongrel.rb:93:in `new' \n        from c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../ \nlib/mongrel.rb:93:in `initialize' \n        from c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../ \nlib/mongrel/configurator.rb:139:in `new' \n        from c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../ \nlib/mongrel/configurator.rb:139:in `listener' \n        from c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/mon \ngrel_rails:99:in `cloaker_' \n        from c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../ \nlib/mongrel/configurator.rb:50:in `call' \n        from c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../ \nlib/mongrel/configurator.rb:50:in `initialize' \n        from c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/mon \ngrel_rails:84:in `new' \n        from c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/mon \ngrel_rails:84:in `run' \n        from c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../ \nlib/mongrel/command.rb:212:in `run' \n        from c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/mon \ngrel_rails:281 \n        from c:/ruby/bin/mongrel_rails:19:in `load' \n        from c:/ruby/bin/mongrel_rails:19 \n

I don't use mongrel on windows myself, but I guess that error is the equivalent of Linux' "port in use" error. Are you trying to bind the server to a port where something else is already listening?

You already have a process listening on port 3000 (the default port for mongrel).

Try:

mongrel_rails start -p 3001

and see whether you get a similar error.

If you're trying to install more than one Rails app, you need to assign each mongrel to a separate port and edit you apache conf accordingly.

If you not trying to do that, the most direct way of killing all mongrels is to open windows task manager and kill all the 'ruby' processes.

Note that if you have mongrel installed as a service that starts automatically

mongrel_rails install::service ...

...the ruby process will regenerate automatically. In that case, you'll have to edit the process properties through the windows services panel. Let me know if you need more info.

On Windows, I found two possible ways for fixing this issue:

  1. Work around: Start the mongrel web server in another port
  2. Solution: Find the ruby.exe process in your task manager and finish it

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM