Skip to content

Remove assertions and skip on missing or broken rrname, bailiwick, rdata on nmsg files#24

Open
regalk13 wants to merge 2 commits into
nextfrom
assertion-convert-fix
Open

Remove assertions and skip on missing or broken rrname, bailiwick, rdata on nmsg files#24
regalk13 wants to merge 2 commits into
nextfrom
assertion-convert-fix

Conversation

@regalk13

Copy link
Copy Markdown

Replaces fatal assert() crashes on invalid records (missing or empty rrname/bailiwick/...) with per-record skip so conversion continues past bad data. And add count_skipped counter reported alongside count_messages.

@regalk13 regalk13 self-assigned this Apr 29, 2026
Comment thread dnstable_convert.c Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I would suggest changing this to

if (((count_messages + count_skipped) % STATS_INTERVAL) == 0)

but otherwise, everything looks good

@cmikk cmikk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Although I'm on board with replacing these assert() calls, this change risks silently discarding indicators of a potentially serious upstream issue.

Preferable alternatives would be:

  1. exit with a failure code rather than abort() on bad data,
  2. count bad data, and exit with a failure code if count_skipped > 0, or
  3. option 1, but with logging.

I would be open to making "skip and count invalid messages" a configurable non-default behavior.

@kadealicious

Copy link
Copy Markdown
Collaborator

Although I'm on board with replacing these assert() calls, this change risks silently discarding indicators of a potentially serious upstream issue.

Preferable alternatives would be:

  1. exit with a failure code rather than abort() on bad data,
  2. count bad data, and exit with a failure code if count_skipped > 0, or
  3. option 1, but with logging.

I would be open to making "skip and count invalid messages" a configurable non-default behavior.

I vote for option #3 with the option to skip+count invalid messages.

@regalk13 regalk13 force-pushed the assertion-convert-fix branch from 045b795 to 89a3e63 Compare July 1, 2026 16:08
Comment thread dnstable_convert.c

for (;;) {
int32_t vid, msgtype;
bool some_skipped;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This should be initialized -- C does not automatically initialize variables, so this could be true / nonzero leading to improperly skipped data.

Comment thread dnstable_convert.c
if (some_skipped) {
nmsg_message_destroy(&msg);
count_skipped += 1;
continue;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The default behavior should be to exit cleanly on invalid input, or break; here, so we don't continue processing when we've decided the input is not 100% valid data.

Comment thread dnstable_convert.c
ubuf_destroy(&val);
do_stats();

if (count_skipped >= 1)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

From a style perspective, count_skipped > 0 is preferable to count_skipped >= 1 here.

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

Successfully merging this pull request may close these issues.

4 participants