[GH-ISSUE #74] Panic on reenabling previously invalid zone #346

Closed
opened 2026-03-13 14:43:25 +03:00 by kerem · 1 comment
Owner

Originally created by @abligh on GitHub (Aug 19, 2015).
Original GitHub issue: https://github.com/abh/geodns/issues/74

This crash is similar to #69 but with a different cause (and different fix)

To replicate:

  • Alter dns/example.com so it is invalid (e.g. put an x at the top)
  • Start geodns
  • Alter dns/example.com so it is valid (e.g. remove the inserted x)
  • Wait for geodns to reload example.com
  • Perform any dig query for that zone e.g. to dig A weight.example.com @....

This produces a panic at:

    z.Metrics.Queries.Mark(1)

on line 34 of zone.go, because z.Metrics is {nil, nil, nil, nil}.

This cause of this problem is that when the zone is first loaded, Metrics is initialised to {nil, nil, nil, nil}. SetupMetrics is never called because the zone is invalid, but the old zone is kept around (presumably because in more complex circumstances it could have useful metrics in which should not be zeroed. When the zone is made loadable, old is non-nil, so the previous Metrics struct is copied, but not initialised, so it remains nil. The fix (coming right up) is to initialise any nil members of the Metrics struct whatever the value of old on entry.

Patch coming right up.

Originally created by @abligh on GitHub (Aug 19, 2015). Original GitHub issue: https://github.com/abh/geodns/issues/74 This crash is similar to #69 but with a different cause (and different fix) To replicate: - Alter `dns/example.com` so it is invalid (e.g. put an `x` at the top) - Start `geodns` - Alter `dns/example.com` so it is valid (e.g. remove the inserted `x`) - Wait for `geodns` to reload `example.com` - Perform any `dig` query for that zone e.g. to `dig A weight.example.com @....` This produces a panic at: ``` z.Metrics.Queries.Mark(1) ``` on line 34 of `zone.go`, because z.Metrics is `{nil, nil, nil, nil}`. This cause of this problem is that when the zone is first loaded, `Metrics` is initialised to `{nil, nil, nil, nil}`. `SetupMetrics` is never called because the zone is invalid, but the old zone is kept around (presumably because in more complex circumstances it could have useful metrics in which should not be zeroed. When the zone is made loadable, `old` is non-nil, so the previous `Metrics` `struct` is copied, but not initialised, so it remains `nil`. The fix (coming right up) is to initialise any `nil` members of the `Metrics` struct whatever the value of `old` on entry. Patch coming right up.
kerem closed this issue 2026-03-13 14:43:30 +03:00
Author
Owner

@abh commented on GitHub (Sep 6, 2015):

This was merged a few days ago.

<!-- gh-comment-id:138134949 --> @abh commented on GitHub (Sep 6, 2015): This was merged a few days ago.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/geodns#346
No description provided.