Project

General

Profile

Bug #13007

Webbrick takes 5s to start when machine name looks like a real domain

Added by grosser (Michael Grosser) almost 3 years ago. Updated almost 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:78492]

Description

sudo scutil --set HostName foo.local
ruby -r socket -e "Socket.gethostbyname(Socket.gethostname)"

or much simpler:

ruby -r socket -e "Socket.gethostbyname('foo.local')"

called from webrick/config.rb:24 ... Utils::getservername

Ideally this should be lazy, so I can override ServerName and avoid this ...
or not do a remote lookup at all by default


Related issues

Related to Ruby master - Feature #6559: Set DoNotReverseLookup to true in WebrickClosedActions

Associated revisions

Revision 03ec7397
Added by shugo (Shugo Maeda) almost 3 years ago

Delay Utils.getservername until needed.

There is no need to call Utils.getservername when the :ServerName option is
specified, so delay Utils.getservername until needed to avoid unnecessary
DNS lookups. [ruby-core:78492] [Bug #13007]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57014 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 57014
Added by shugo (Shugo Maeda) almost 3 years ago

Delay Utils.getservername until needed.

There is no need to call Utils.getservername when the :ServerName option is
specified, so delay Utils.getservername until needed to avoid unnecessary
DNS lookups. [ruby-core:78492] [Bug #13007]

Revision 57014
Added by shugo (Shugo Maeda) almost 3 years ago

Delay Utils.getservername until needed.

There is no need to call Utils.getservername when the :ServerName option is
specified, so delay Utils.getservername until needed to avoid unnecessary
DNS lookups. [ruby-core:78492] [Bug #13007]

Revision 57014
Added by shugo (Shugo Maeda) almost 3 years ago

Delay Utils.getservername until needed.

There is no need to call Utils.getservername when the :ServerName option is
specified, so delay Utils.getservername until needed to avoid unnecessary
DNS lookups. [ruby-core:78492] [Bug #13007]

Revision 57014
Added by shugo (Shugo Maeda) almost 3 years ago

Delay Utils.getservername until needed.

There is no need to call Utils.getservername when the :ServerName option is
specified, so delay Utils.getservername until needed to avoid unnecessary
DNS lookups. [ruby-core:78492] [Bug #13007]

History

Updated by shyouhei (Shyouhei Urabe) almost 3 years ago

Sad news is gethostbyname blocks under the hood in the system library, not in ruby's code.

But webrick's issue might be resolved already by issue #6559. Can you try the latest trunk to see if that fixed your problem?

#2

Updated by shyouhei (Shyouhei Urabe) almost 3 years ago

  • Related to Feature #6559: Set DoNotReverseLookup to true in Webrick added

Updated by shugo (Shugo Maeda) almost 3 years ago

Shyouhei Urabe wrote:

Sad news is gethostbyname blocks under the hood in the system library, not in ruby's code.

But webrick's issue might be resolved already by issue #6559. Can you try the latest trunk to see if that fixed your problem?

It seems not a reverse lookup issue, but a forward lookup issue.

It sounds reasonable to delay the call of Utils.getservername so that
users can override ServerName, in which case there's no need to call
Utils.getservername.

Updated by shyouhei (Shyouhei Urabe) almost 3 years ago

Hmm, I see. No objection for the approach then.

#5

Updated by shugo (Shugo Maeda) almost 3 years ago

  • Status changed from Open to Closed

Applied in changeset r57014.


Delay Utils.getservername until needed.

There is no need to call Utils.getservername when the :ServerName option is
specified, so delay Utils.getservername until needed to avoid unnecessary
DNS lookups. [ruby-core:78492] [Bug #13007]

Also available in: Atom PDF