dnsimple / erldns

DNS server, in Erlang.
MIT License
398 stars 98 forks source link

Possible race condition in `zone_cache:put_zone/1`? #135

Open g-andrade opened 2 years ago

g-andrade commented 2 years ago

Hi,

I've been using erldns 2.2.0 as a library (great library, by the way!)

I happened to take a look into erldns_zone_cache:put_zone/1 and, if the cache works the way I superficially understood it to, there appears to be race condition between invoking delete_zone_records/1 and put_zone/2. https://github.com/dnsimple/erldns/blob/97d2b8ec029f89eec4adb5f49af6d241d457bf86/src/erldns_zone_cache.erl#L277-L283

Did I understood it correctly? Is there a tiny window where lookups might fail every time put_zone/1 is used? If so, would you be open to changing the order between calls? I'd be available for a PR.

Thanks!

g-andrade commented 2 years ago

(Bump)

g-andrade commented 1 year ago

(Bump 🥺)