Rubymine 5 - Problem starting the mongrel server (socket address error)

Currently at work I'm using Ruby 1.87 w/ Rails 2.3.5  (no choice in that right now - corporate intranet setup).   Windows 7 32bit

On my system, Rubymine 5.0.2 does not seem to always correctly close the Mongrel port.   When this starts happening, every so often after a few attempts of closing and re-opening the server tab in Rubymine, it might start working.   At times, the only thing that fixes it is a reboot.   I think there's some random bug that doesn't always show up where disconnecting from a Mongrel server in Rubymine 5.0.2 does not correctly close or clear port 3000.

This is server error message:

runnerw.exe C:\Ruby187\bin\ruby.exe -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) "C:/Rails Projects/TEST/script/server" -b 127.0.0.1 -p 3000 -e development
=> Booting Mongrel
=> Rails 2.3.5 application starting on http://127.0.0.1:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
C:/Ruby187/lib/ruby/gems/1.8/gems/mongrel-1.2.0.pre2-x86-mingw32/lib/mongrel/tcphack.rb:12:in `initialize_without_backlog': Only one usage of each socket address (protocol/network address/port) is normally permitted. - bind(2) (Errno::EADDRINUSE)
    from C:/Ruby187/lib/ruby/gems/1.8/gems/mongrel-1.2.0.pre2-x86-mingw32/lib/mongrel/tcphack.rb:12:in `initialize'
    from C:/Ruby187/lib/ruby/gems/1.8/gems/mongrel-1.2.0.pre2-x86-mingw32/lib/mongrel.rb:99:in `new'
    from C:/Ruby187/lib/ruby/gems/1.8/gems/mongrel-1.2.0.pre2-x86-mingw32/lib/mongrel.rb:99:in `initialize'
    from C:/Rails Projects/TEST/vendor/gems/rack-1.0.1/lib/rack/handler/mongrel.rb:10:in `new'
    from C:/Rails Projects/TEST/vendor/gems/rack-1.0.1/lib/rack/handler/mongrel.rb:10:in `run'
    from C:/Rails Projects/TEST/vendor/rails/railties/lib/commands/server.rb:111
    from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `gem_original_require'
    from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `require'
    from C:/Rails Projects/TEST/script/server:3
    from -e:1:in `load'
    from -e:1

Process finished with exit code 1

Thanks for any help.

10 comments

Hi,

it looks like 3000 port is occupied by some process (or mongrel thinks so).
I'd try to check who is serving this port when you have this problem.
BTW have you experience this problem when you run serer from command line?

Regards, Oleg.

0

No - I do not have this problem from the command line or any other version of Rubymine.   I've been using Rubymine for a couple of years now without ever seeing this and I use it every day.  I really think there's some intermittant bug where Rubymine isn't closing the mongrel server when the Run window is closed (I ususally just use the red x to clear the run window instead of the stop button).

0

So, do you see mongrel in the list of running process after you kill it in RM?

Regards, Oleg.

0

Good point, I've never bothered to look.  I probably could have cleared things up but looking for a process and killing it when this happens.  The next time it happens I'll do that and report back.  Thank You!

0

OK it just happned again.   I don't see a service or process in the task manager that obviously belongs to Mongrel but Rubymine 5 definetly did not correctly shut mongrel down.

I've got no choice but to reboot now.    I guess I'll give Rubymine5 one more shot by trying to use STOP (CTRL+F2) before I use CLOSE (CTRL+F4) and if that doesn't work I'll just forget about Rubymine5 and go back to Rubymine 4 (where I never had this issue since Rubymine 4 was first released).

Thanks.

0

Could you please file a ticket about the problem in out tracker http://youtrack.jetbrains.com/issues/RUBY

Oleg.

0

You know with Rubymine 5 open and stopped at that error (socket in use), I can open a CMD prompt and manually start the server without any problem.

Of course I'm using >ruby script/server mongrel

And rubymine is using:  "C:/Rails Projects/TEST/script/server" -b 127.0.0.1 -p 3000 -e development


Color me confused.

0

Have you tried to specify exact port (3000) when you are ringing server from command line?
(to make sure that in this case mongrel uses the same port)

Oleg.

0

No sir, but the commad line clearly reflected port 3000 was being used (example):

=> Rails 2.3.5 application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server

Yesterday I switch back to Rubymine 4.5.4 and used it all day and this morning, starting and stoping the Run window (Mongrel server) multiple times without any issue.   This problem is something specific to Rubymine 5.0.2.  I understand it could easily be something specific to my personal setup.  For some reason on my system Rubymine 5.0.2 does not seem to actually shut down the Mongrel server (and again, after using most of the Rubymine 3 and Rubymine 4 versions over the last two years, I haven't had this issue before).


I see now that when a server is opened a "Ruby.exe" process is created.    Rubymine 5.0.2 (after a first server is disconnected from) leaves that process open.  Attempting to start the server again and the socket error occurs.   When the socket error occurs, the 1st process is actually ended instead of the 2nd processes Rubymine was just trying to open (maybe becaue the process id number is lower on the first process or something).

Anyway,  all I need to do when this happens is just manually close any open "Ruby.exe" processes before trying to start a server again.   I did try running Rubymine 5.0.2 with admin priviledges and that did not help.   Something about Rubymine 5.0.2 on my system is not actually ending the Ruby.exe process it opened to start the server (where every other version of Rubymine that's come before does do it correclty).

Thanks

0

Please sign in to leave a comment.