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

dnsdist: Handle out-of-memory exceptions in the UDP receiver thread #12387

Merged
merged 3 commits into from
Jan 10, 2023

Conversation

rgacogne
Copy link
Member

@rgacogne rgacogne commented Jan 6, 2023

Short description

Most exceptions are handled by handleOnePacket(), but we might be out of memory (std::bad_alloc) in which case we DO NOT want to log (as it would trigger another memory allocation attempt that might throw as well) but wait a bit (one millisecond) and then try to recover.

Checklist

I have:

  • read the CONTRIBUTING.md document
  • compiled this code
  • tested this code
  • included documentation (including possible behaviour changes)
  • documented the code
  • added or modified regression test(s)
  • added or modified unit test(s)

Copy link
Member

@omoerbeek omoerbeek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was a bit puzzled by the while loop calling handleOnePacket not having a try-catch block and the (dynamic) nesting of try-catch blocks in the else branch.
Is it an idea to not have a try/catch block in handleOnePacket, but have it in the two call spots? IMO it would make the structure more clear as the two spots calling handleOnePacket would have the same structure.

@rgacogne
Copy link
Member Author

rgacogne commented Jan 9, 2023

Done!

@rgacogne rgacogne merged commit ff94437 into PowerDNS:master Jan 10, 2023
@rgacogne rgacogne deleted the ddist-oom-udp branch January 10, 2023 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants