Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
g-andrade opened this issue Nov 10, 2021 · 2 comments
Open

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

g-andrade opened this issue Nov 10, 2021 · 2 comments
Assignees

Comments

@g-andrade
Copy link

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.

put_zone({Name, Sha, Records, Keys}) ->
SignedZone = sign_zone(build_zone(Name, Sha, Records, Keys)),
NamedRecords = build_named_index(SignedZone#zone.records),
delete_zone_records(erldns:normalize_name(Name)),
case put_zone(erldns:normalize_name(Name), SignedZone#zone{records = trimmed}) of
ok ->
put_zone_records(erldns:normalize_name(Name), NamedRecords);

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
Copy link
Author

(Bump)

@g-andrade
Copy link
Author

(Bump 🥺)

@whatyouhide whatyouhide self-assigned this Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants