Feature #1811
Default BasicSocket.do_not_reverse_lookup to true
| Status: | Closed | Start date: | 07/23/2009 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | % Done: | 100% |
||
| Category: | - | |||
| Target version: | - |
Description
Currently ruby socket code defaults to always doing reverse DNS lookup [ex: once per incoming UDP packet, once per TCP connection]. This causes "surprising" pauses if lookup fails, because the DNS waits 15s to timeout, before passing the packet back to the program, the pauses are surprising, not appropriate for production, cause bugs[1] and cause an overly chatty network. Proposal is: default do_not_reverse_lookup to true and/or change name to do_reverse_lookup= to avoid double negative. See discussions: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/24247 http://www.ruby-forum.com/topic/190013 Thanks. =r [1] http://www.ruby-forum.com/topic/191022
Related issues
| related to ruby-trunk - Bug #496: DRb.start_service(nil) is very slow | Closed | 08/25/2008 |
Associated revisions
* ext/socket/socket.c: turn on do_not_reverse_lookup by default,
which has been reverted in r9880 probably unintentionally,
according to matz. [ruby-core:24530]
History
Updated by Daniel Berger over 2 years ago
I agree, although I'd favor getting rid of the 'do_' and just make it Socket.reverse_lookup= Regards, Dan
Updated by Kirk Haines over 2 years ago
This seems completely reasonable to me. Most serious networking code is going to disable the reverse DNS lookups anyway, so Ruby may as well default to the option most code is going to want. Kirk Haines
Updated by Roger Pack over 2 years ago
- File do_not_reverse_lookup.diff added
Here's a patch that does it. None of the documentation seems to mention that it defaults to true, so this should be enough for now. Socket doesn't appears to have a maintainer [1] so anybody want to? Thanks. -r [1] http://redmine.ruby-lang.org/wiki/ruby/Maintainers
Updated by Roger Pack over 2 years ago
Interestingly, when I apply this patch, then run make test-all, two tests that previously broke:
2) Error:
test_cookie(TestCookie):
NoMethodError: undefined method `shutdown' for nil:NilClass
/home/rdp/dev/downloads/ruby_trunk/test/xmlrpc/webrick_testing.rb:32:in `block in stop_server'
11) Error:
test_client_server(Test_Webrick):
NoMethodError: undefined method `shutdown' for nil:NilClass
/home/rdp/dev/downloads/ruby_trunk/test/xmlrpc/webrick_testing.rb:32:in `block in stop_server'
Now succeed happily--appears that there's a timing issue where the setup thread is not completing early enough because it is blocked doing DNS lookups :)
Thanks.
-r
Updated by ujihisa . about 2 years ago
- Status changed from Open to Assigned
- Assignee set to Nobuyoshi Nakada
Updated by Nobuyoshi Nakada about 2 years ago
- Status changed from Assigned to Closed
- % Done changed from 0 to 100
This issue was solved with changeset r26541. Roger, thank you for reporting this issue. Your contribution to Ruby is greatly appreciated. May Ruby be with you.