[BUG] SocketError when trying to run a WEBRick server
Reported by Simon Rozet | June 6th, 2008 @ 07:28 AM | in 1.0 preview
Test script
require 'webrick'
server = WEBrick::HTTPServer.new({:Port => 10080})
server.mount('/', WEBrick::HTTPServlet::FileHandler, Dir.pwd, true)
trap(:INT) { server.shutdown }
server.start
Error
~/src/rbx (sinatra) % ./shotgun/rubinius webrick_test.rb
[2008-06-06 16:18:18] INFO WEBrick 1.3.1
[2008-06-06 16:18:18] INFO ruby 1.8.6 (06/06/2008) [i686-pc-linux-gnu]
An exception has occurred:
Name or service not known (SocketError)
Backtrace:
Socket::Foreign.getaddrinfo at /home/simon/src/rbx/lib/socket.rb:185
Socket.getaddrinfo at /home/simon/src/rbx/lib/socket.rb:364
WEBrick::Utils.create_listeners at /home/simon/src/rbx/lib/webrick/utils.rb:63
WEBrick::GenericServer(WEBrick::HTTPServer)#listen at /home/simon/src/rbx/lib/webrick/server.rb:75
WEBrick::GenericServer(WEBrick::HTTPServer)#initialize at /home/simon/src/rbx/lib/webrick/server.rb:63
WEBrick::HTTPServer#initialize at /home/simon/src/rbx/lib/webrick/httpserver.rb:24
Class#new at kernel/bootstrap/class.rb:12
Object#__script__ at webrick_test.rb:2
CompiledMethod#as_script at kernel/core/compiled_method.rb:379
Compile.single_load at kernel/core/compile.rb:252
Compile.load_from_extension at kernel/core/compile.rb:324
Object#__script__ at kernel/loader.rb:270
Environment
~ % uname -a
Linux mallory 2.6.22-14-generic #1 SMP Tue Feb 12 07:42:25 UTC 2008 i686 GNU/Linux
~/src/rbx (sinatra) % ./shotgun/rubinius -v
rubinius 0.8.0 (ruby 1.8.6 compatible) (e8505a517) (06/06/2008) [i686-pc-linux-gnu]
Comments and changes to this ticket
-

Simon Rozet June 6th, 2008 @ 07:37 AM
oh BTW, more informations are needed (or anything), I am `sr` on #rubinius
-

Vitaliy Geraymovych June 10th, 2008 @ 10:42 AM
I tried your test script on Mac OS X 10.5 It didn't fail.
~/work $ rubinius/shotgun/rubinius webrick_test.rb
[2008-06-10 13:39:31] INFO WEBrick 1.3.1
[2008-06-10 13:39:31] INFO ruby 1.8.6 (06/09/2008) [i686-apple-darwin9.3.0]
[2008-06-10 13:39:31] INFO WEBrick::HTTPServer#start: pid=43317 port=10080
I am assuming that you tried to run the test with MRI. Did you get same error?
-

Simon Rozet June 10th, 2008 @ 01:30 PM
I am assuming that you tried to run the test with MRI. Did you get same error?
Yes I did and it ran perfectly. I really have no idea of what might cause that bug :/
-
Federico Builes June 11th, 2008 @ 08:42 PM
- → State changed from new to open
- → Assigned user changed from to Federico Builes
There's something wrong with the BindAddress on Linux right now, I'll try to look what's wrong.
In the meantime, you can fix the issue by setting the server up with a BindAddress like this:
server = WEBrick::HTTPServer.new({:Port => 10080, :BindAddress => "127.0.0.1"})
-
Federico Builes June 15th, 2008 @ 10:25 AM
- → State changed from open to resolved
This has been fixed in commit 96e9727, please try it out and let us know. Reopen if needed.
-

Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
