From: Brian Candler on
Raul Parolari wrote:
> a) I do not think that there can be a DNS lookup between a 'select(x, y,
> z)' and a 'socket.recvfrom'.

But in Ruby, recvfrom itself (unfortunately) does a reverse DNS lookup
on the IP address of the peer. You really need to turn this off.

If one DNS packet gets lost, and your resolver doesn't retransmit for 10
seconds, then there's your 10 second delay. It's unlikely that the
garbage collector would (a) take so long, and (b) take such a consistent
amount of time.

Regards,

Brian.
--
Posted via http://www.ruby-forum.com/.

From: Roger Pack on
Brian Candler wrote:
> Raul Parolari wrote:
>> a) I do not think that there can be a DNS lookup between a 'select(x, y,
>> z)' and a 'socket.recvfrom'.
>
> But in Ruby, recvfrom itself (unfortunately) does a reverse DNS lookup
> on the IP address of the peer. You really need to turn this off.

You could try recv, which I don't *think* does any DNS lookups. Also
setting do_not_reverse_lookup should overcome the related delay...
--
Posted via http://www.ruby-forum.com/.

From: Raul Parolari on
Roger Pack wrote:
>
>>> Try your code with
>>> BasicSocket.do_not_reverse_lookup=true
>>
>> Three observations:
>>
>> a) I do not think that there can be a DNS lookup between a 'select(x, y,
>> z)' and a 'socket.recvfrom'.
>
> It might, see
> http://www.ensta.fr/~diam/ruby/online/ruby-doc-stdlib/libdoc/socket/rdoc/classes/Socket.html#M001258
>

Roger,

It is stunning to think that a 'recvfrom' on a socket (done after the
'select' signaled that there data ready to be read in the queue for that
socket) might go off doing reverse dns queries (instead of just
returning the packet).
Also, I did not see anything pointing to this in the link you provided
(I read the whole page and the only place where it mentions 'reverse dns
queries' is when issuing 'gethostbyname').

But it is true that we cannot trust anything nowadays, and it does not
harm to include a line to avoid reverse dns queries. I did (at socket
creation).

We are not running any more the experiment where this problem occurred,
so I cannot say now if this fixed it. But thanks for the tip.

Raul Parolari
raulparolari(a)gmail.com



--
Posted via http://www.ruby-forum.com/.

From: Roger Pack on

> It is stunning to think that a 'recvfrom' on a socket (done after the
> 'select' signaled that there data ready to be read in the queue for that
> socket) might go off doing reverse dns queries (instead of just
> returning the packet).

Agreed. Thankfully with 1.9.2 this is no longer the default.

> Also, I did not see anything pointing to this in the link you provided
> (I read the whole page and the only place where it mentions 'reverse dns
> queries' is when issuing 'gethostbyname').

Agreed.
--
Posted via http://www.ruby-forum.com/.

From: Mark T on
Wow Raul,
You know how to write a thriller at least!

> We are not running any more the experiment where this problem occurred,
> so I cannot say now if this fixed it. But thanks for the tip.

Does this mean the story is unfinished?

MarkT

First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4
Prev: Threading with Activerecord
Next: Aliasing classes