[tor-bugs] #7480 [Tor]: cached_resolve_t expiration is overengineered

Tor Bug Tracker & Wiki blackhole at torproject.org
Thu Nov 15 13:49:55 UTC 2012


#7480: cached_resolve_t expiration is overengineered
---------------------------------------+------------------------------------
 Reporter:  nickm                      |          Owner:                  
     Type:  defect                     |         Status:  new             
 Priority:  normal                     |      Milestone:  Tor: unspecified
Component:  Tor                        |        Version:                  
 Keywords:  tor-relay dns refactoring  |         Parent:                  
   Points:                             |   Actualpoints:                  
---------------------------------------+------------------------------------
 There are two misfeatures in the way we expire pending and cached DNS
 requests—maybe three.

 1. We schedule expiration with a priority queue.  That's probably over-
 engineered.  Instead, we could just walk the hash table periodically and
 remove expired entries. If we choose an appropriate interval, we shouldn't
 lose too much CPU to walking the hash table.

 2. We can't remove or re-order entries in the priority queue before they
 expire. That means that when a pending cached_resolve_t gets its
 answers/errors and becomes done, we don't currently remove it: instead we
 make a copy of it to represent the done cached_resolve_t, put that in the
 priority queue too, and wait for the pending one to expire on its own.
 How silly.

 3. Pending DNS requests probably don't need to be scheduled for expiration
 at all: we already have timeout logic in evdns.c to ensure that a DNS
 request that doesn't complete will get treated as an error.  I don't think
 we need a separate means to expire them.

-- 
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/7480>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list