Forum: Ruby on Rails Help - WEBrick won't start - "Bad file descriptor" error

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Christopher J. Mackie (Guest)
on 2006-02-27 00:30
(Received via mailing list)
I have been working for a few days on a new (Windows) system, and
suddenly WEBrick won't start. Full error text is at bottom of message.

It began after I followed Brian H.'s (terrific!) instructions for
setting up Eclipse w/Rails in Windows
( The server started
fine from w/in Eclipse when I reached that part of the instructions, but
when I got to the end I found the server broken (hadn't started the
server in the meantime, so I can't say for sure when it happened).
WEBrick now doesn't work from inside Eclipse or from the command line;
identical errors. I tried creating a new rails command-line project in
case the projects inside Eclipse were damaged; no difference.

I also tried rewinding, but even complete uninstall/reinstalls of ruby
and rails don't fix the problem. These are completely basic projects --
no plug-ins, I haven't even generated a scaffold or any
models/controllers yet.

Anyone able to shed any light?


///Here's the trace:

 Booting WEBrick...
=> Rails application started on
=> Ctrl-C to shutdown server; call with --help for options
[2006-02-26 17:09:10] INFO  WEBrick 1.3.1
[2006-02-26 17:09:10] INFO  ruby 1.8.4 (2005-12-24) [i386-mswin32]
[2006-02-26 17:09:10] WARN  TCPServer Error: Bad file descriptor -
c:/bin/ruby/lib/ruby/1.8/webrick/utils.rb:73:in `initialize': Bad file
descriptor - bind(2) (Errno::EBADF)
	from c:/bin/ruby/lib/ruby/1.8/webrick/utils.rb:73:in
	from c:/bin/ruby/lib/ruby/1.8/webrick/utils.rb:70:in
	from c:/bin/ruby/lib/ruby/1.8/webrick/server.rb:75:in `listen'
	from c:/bin/ruby/lib/ruby/1.8/webrick/server.rb:63:in
	from c:/bin/ruby/lib/ruby/1.8/webrick/httpserver.rb:24:in
in `dispatch'
t/dependencies.rb:214:in `require'
t/dependencies.rb:214:in `require'
	from script/server:3

/// Here's the code around the point of failure (line 73):
/// c:/bin/ruby/lib/ruby/1.8/webrick/utils.rb

70      res.each{|ai|
71        begin
72          logger.debug("{ai[3]}, #{port})") if logger
73          sock =[3], port)
74          port = sock.addr[1] if port == 0
75          Utils::set_close_on_exec(sock)
76          sockets << sock
77        rescue => ex
78          logger.warn("TCPServer Error: #{ex}") if logger
79          last_error  = ex
80        end
Michael T. (Guest)
on 2006-02-27 03:54
(Received via mailing list)
I had the same problem and posted about it here as well.  I think it's
somehow related to eclipse tying up a port.  If you do a:

ruby script\server --port=8000

It should work fine.  But you'll have to navigate to
http://localhost:8000 instead.

This topic is locked and can not be replied to.