WEBrick Bad File Descriptor Error


#1

All of a sudden I have a wierd error when running script/server on a
Windows XP box. Webrick is failing with a bad file descriptor error.
I’m sure it’s conflicting with something in my enviornment, but I
cannot figure out what. I googled the issue and haven’t been able to
find any answer for it.

Although, I did find a workaround. If I’m using a port above 8000 by
doing script/server --port=8000 it works fine. I am not running a
firewall on this machine, either.

The only change I made was going from 1.82 to 1.84. I first went to
InstantRails, because I’ve been running that successfully on another
machine. I then tried the One-Click installer. Same results on both.

Any ideas?

Michael


#2

On Feb 25, 2006, at 8:08 AM, Michael T. wrote:

The only change I made was going from 1.82 to 1.84. I first went to
InstantRails, because I’ve been running that successfully on another
machine. I then tried the One-Click installer. Same results on both.

Any ideas?

Hard to say without the actual error message including backtrace.


Eric H. - removed_email_address@domain.invalid - http://blog.segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com


#3

That was dumb of me. Here is the error information. This is all the
output I get. BTW, I tried going into irb and calling
create_listeners directly, passing in the same information that rails
is sending, and I do not have a problem.

On another note, it was right after trying to switch over to use
InstantRails when this happened, and I notice that there is another
thread about InstantRails issues with webrick, but their experiences
seem to be unrelated. I’ve switched back to the One-Click installer,
but the 1.84 version. Thanks Eric.

[2006-02-26 05:15:45] INFO WEBrick 1.3.1
[2006-02-26 05:15:45] INFO ruby 1.8.4 (2005-12-24) [i386-mswin32]
[2006-02-26 05:15:45] WARN TCPServer Error: Bad file descriptor -
bind(2)
D:/Ruby/lib/ruby/1.8/webrick/utils.rb:73:in initialize': Bad file descriptor - bind(2) (Errno::EBADF) from D:/Ruby/lib/ruby/1.8/webrick/utils.rb:73:increate_listeners’
from D:/Ruby/lib/ruby/1.8/webrick/utils.rb:70:in
create_listeners' from D:/Ruby/lib/ruby/1.8/webrick/server.rb:75:inlisten’
from D:/Ruby/lib/ruby/1.8/webrick/server.rb:63:in initialize' from D:/Ruby/lib/ruby/1.8/webrick/httpserver.rb:24:ininitialize’
from
./script/…/config/…/vendor/rails/railties/lib/webrick_server.rb:6
1:in dispatch' from ./script/../config/../vendor/rails/railties/lib/commands/servers/we brick.rb:59 from D:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:inre
quire’
from
./script/…/config/…/vendor/rails/activesupport/lib/active_support
/dependencies.rb:153:in require' from ./script/../config/../vendor/rails/railties/lib/commands/server.rb: 28 from D:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:inre
quire’
from script/server:3


#4

On 2/26/06, Michael T. removed_email_address@domain.invalid wrote:

That was dumb of me. Here is the error information. This is all the
output I get. BTW, I tried going into irb and calling
create_listeners directly, passing in the same information that rails
is sending, and I do not have a problem.

On another note, it was right after trying to switch over to use
InstantRails when this happened, and I notice that there is another
thread about InstantRails issues with webrick, but their experiences
seem to be unrelated. I’ve switched back to the One-Click installer,
but the 1.84 version. Thanks Eric.

FWIW, the 1.8.4 version of the one-click installer is the same binary
build of ruby that is in Instant Rails, the OCI just has a few more
extensions installed. Oncethe final 1.8.4 version of the OCI is
release, it will be put into Instant Rails for the Instant Rails 1.1
release.

Curt


#5

Curt H. wrote:

On 2/26/06, Michael T. removed_email_address@domain.invalid wrote:

That was dumb of me. Here is the error information. This is all the
output I get. BTW, I tried going into irb and calling
create_listeners directly, passing in the same information that rails
is sending, and I do not have a problem.

On another note, it was right after trying to switch over to use
InstantRails when this happened, and I notice that there is another
thread about InstantRails issues with webrick, but their experiences
seem to be unrelated. I’ve switched back to the One-Click installer,
but the 1.84 version. Thanks Eric.

FWIW, the 1.8.4 version of the one-click installer is the same binary
build of ruby that is in Instant Rails, the OCI just has a few more
extensions installed. Oncethe final 1.8.4 version of the OCI is
release, it will be put into Instant Rails for the Instant Rails 1.1
release.

Curt

It’s just a (wild) guess, but when bind(2) fails, its usually means the
IP port you are binding to is already in use. I don’t know what the
Windows equiv of “netstat -an” to see all open/closing sockets is, but
this whould tell you for certain. If that were the case, a reboot would
fix the problem (to test the theory, not that this is a reasonable
workaround).

Mat Cucuzella


#6

Somone else also got the same problem, posted about 1 day later, and
now I believe it’s related to eclipse. Eclipse must be blocking a set
of ports in that same range. I thought it was related to
InstantRails, because that’s when the problem cropped up, but after
the other posting, I realized that I also started using eclipse. At
least that’s where I’m at with it right now. It’s not a big deal now
that I know I can get around it, but it was sure a time waster.

I’d be curious if there’s anyone else running 1.8.4 with eclipse
and/or RadRails.

Thanks,

Michael