Opened 10 years ago

Closed 10 years ago

#1710 closed defect (fixed)

Bug in resolver when updating cache entry

Reported by: nanang Owned by: bennylp
Priority: normal Milestone: release-2.2
Component: pjlib-util Version: trunk
Keywords: Cc:
Backport to 1.x milestone: Backported: no

Description

Usually updating an entry will be started by removing the entry from the cache hash table before transmitting a query to nameserver, so when there is incoming response from name server, it is an ADD operation to the hash table. However, there are rare cases that it is an UPDATE operation to the cache hash table, e.g: manual entry update via pj_dns_resolver_add_entry(). Unfortunately, for an UPDATE operation, there seems to be a bug: releasing/resetting entry pool must be done after removing the entry from hash table as the entry key is allocated using the entry pool.

Note that, another case that may trigger UPDATE operation to the cache hash table is: two queries for the same name/key in a short interval, i.e: when the second query comes while the first query response has been received and resolver is invoking callback to app, it will transmit another request to nameserver as a cache entry hasn't been updated/added and pending query flag has been cleared, and when this second query response is received, it will UPDATE the existing cache entry.

Change History (1)

comment:1 Changed 10 years ago by nanang

  • Resolution set to fixed
  • Status changed from new to closed

In 4649:

Fix #1710: Modified resolver to always remove cache entry from cache hash table first before releasing/resetting cache pool.

Note: See TracTickets for help on using tickets.