# WEBrick Bad File Descriptor Error

**URL:** <https://www.ruby-forum.com/t/webrick-bad-file-descriptor-error/54179>\
**Category:** Rails\
**Created:** [February 25, 2006, 5:11pm UTC](https://www.ruby-forum.com/t/webrick-bad-file-descriptor-error/54179 "2006-02-25T17:11:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![afewtips](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/76d3ee/32.png) [@afewtips](https://www.ruby-forum.com/u/afewtips)\
**Post date:** [February 25, 2006, 5:11pm UTC](https://www.ruby-forum.com/t/webrick-bad-file-descriptor-error/54179/1 "2006-02-25T17:11:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![afewtips](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/76d3ee/32.png) [@afewtips](https://www.ruby-forum.com/u/afewtips)\
**Post date:** [February 26, 2006, 3:17am UTC](https://www.ruby-forum.com/t/webrick-bad-file-descriptor-error/54179/2 "2006-02-26T03:17:52Z")

</div>

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](http://blog.segment7.net)  
This implementation is HODEL-HASH-9600 compliant

[http://trackmap.robotcoop.com](http://trackmap.robotcoop.com)

---

<div class="post-metadata">

**Author:** ![afewtips](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/76d3ee/32.png) [@afewtips](https://www.ruby-forum.com/u/afewtips)\
**Post date:** [February 26, 2006, 11:16am UTC](https://www.ruby-forum.com/t/webrick-bad-file-descriptor-error/54179/3 "2006-02-26T11:16:37Z")

</div>

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:in`create\_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:in`listen’  
from D:/Ruby/lib/ruby/1.8/webrick/server.rb:63:in `initialize' from D:/Ruby/lib/ruby/1.8/webrick/httpserver.rb:24:in`initialize’  
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:in`re  
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:in`re  
quire’  
from script/server:3

---

<div class="post-metadata">

**Author:** ![afewtips](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/76d3ee/32.png) [@afewtips](https://www.ruby-forum.com/u/afewtips)\
**Post date:** [February 27, 2006, 5:53am UTC](https://www.ruby-forum.com/t/webrick-bad-file-descriptor-error/54179/4 "2006-02-27T05:53:08Z")

</div>

On 2/26/06, Michael T. [removed\_email\_address@domain.invalid](mailto: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

---

<div class="post-metadata">

**Author:** ![afewtips](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/76d3ee/32.png) [@afewtips](https://www.ruby-forum.com/u/afewtips)\
**Post date:** [February 27, 2006, 6:56am UTC](https://www.ruby-forum.com/t/webrick-bad-file-descriptor-error/54179/5 "2006-02-27T06:56:13Z")

</div>

Curt H. wrote:

> On 2/26/06, Michael T. [removed\_email\_address@domain.invalid](mailto: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

---

<div class="post-metadata">

**Author:** ![afewtips](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/76d3ee/32.png) [@afewtips](https://www.ruby-forum.com/u/afewtips)\
**Post date:** [February 27, 2006, 11:24am UTC](https://www.ruby-forum.com/t/webrick-bad-file-descriptor-error/54179/6 "2006-02-27T11:24:06Z")

</div>

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
