Forum: Ruby ruby suggestion:do_not_reverse_lookup = true as default

Bec38d63650c8912b6ba9b557fb953b9?d=identicon&s=25 Roger Pack (rogerdpack)
on 2009-06-22 12:41
Currently ruby socket code defaults to always doing a reverse DNS lookup
when it can [ex: once per incoming UDP packet].
This causes "surprising" pauses when the lookup fails, because the DNS
waits 15s to timeout, before passing the packet back to the program,
since the pause is unexpected.

ex: http://betterlogic.com/roger/?p=1646
comment out the do_not_reverse_lookup on the receiver and change the
sender to send to IP127.0.0.255

It works great [no pause]if you set BasicSocket.do_not_reverse_lookup to
true, and is much less surprising.  This isn't the first time I've been
bit by ruby's internal packet DNS lookups and so thought I'd ask for
feedback before suggesting to core that it be turned off by default.

The other benefit is that with DNS lookups, sometimes they succeed, and
sometimes fail, which means that normal code could run into unexpected
pauses when put into production--which is surprising and unwanted,
really.

Thoughts on this one?
Thanks.
Fa2521c6539342333de9f42502657e5a?d=identicon&s=25 Eleanor McHugh (Guest)
on 2009-06-22 13:28
(Received via mailing list)
On 22 Jun 2009, at 11:41, Roger Pack wrote:
>
> pauses when put into production--which is surprising and unwanted,
> really.
>
> Thoughts on this one?
> Thanks.

I tend to agree with you on this although I'd also suggest that the
option become do_reverse_lookup if it's going to default to false,
that avoids having to read lots of code peppered with
do_not_reverse_lookup = false when a reverse lookup is desired. Double
negatives are a guaranteed way to scramble frazzled brains :)


Ellie

Eleanor McHugh
Games With Brains
http://slides.games-with-brains.net
----
raise ArgumentError unless @reality.responds_to? :reason
E0526a6bf302e77598ef142d91bdd31c?d=identicon&s=25 Daniel DeLorme (Guest)
on 2009-06-23 02:20
(Received via mailing list)
Eleanor McHugh wrote:
>>
>> Thoughts on this one?
>> Thanks.
>
> I tend to agree with you on this although I'd also suggest that the
> option become do_reverse_lookup if it's going to default to false, that
> avoids having to read lots of code peppered with do_not_reverse_lookup =
> false when a reverse lookup is desired. Double negatives are a
> guaranteed way to scramble frazzled brains :)

+1 on both suggestions

I've been bit by this reverse lookup in the past. Even when setting
Net::HTTP's open_timeout, this has no effect on the rDNS lookup so an
operation with a timeout of 1s can actually time out after 15s. Very
confusing.

And really, minimizing unnecessary reverse lookups is better for the
health of the internet in general.

Daniel
Fa2521c6539342333de9f42502657e5a?d=identicon&s=25 Eleanor McHugh (Guest)
on 2009-06-23 19:10
(Received via mailing list)
On 23 Jun 2009, at 01:19, Daniel DeLorme wrote:
> I've been bit by this reverse lookup in the past. Even when setting
> Net::HTTP's open_timeout, this has no effect on the rDNS lookup so
> an operation with a timeout of 1s can actually time out after 15s.
> Very confusing.
>
> And really, minimizing unnecessary reverse lookups is better for the
> health of the internet in general.

Very true, especially with dynamic DNS with short-ttl zones finally
starting to catch on.


Ellie

Eleanor McHugh
Games With Brains
http://slides.games-with-brains.net
----
raise ArgumentError unless @reality.responds_to? :reason
84dc575c33a123789521d53cad0f62ae?d=identicon&s=25 Lloyd Linklater (lloyd)
on 2009-06-23 21:11
Eleanor McHugh wrote:
> Double
> negatives are a guaranteed way to scramble frazzled brains :)

I am not sure that you didn't mean to not neglect to avoid not saying
this.  :)
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.