mirror of
https://github.com/abh/geodns.git
synced 2026-04-26 19:35:51 +03:00
[PR #75] [CLOSED] Fix crash on enabling previously invalid zone #118
Labels
No labels
bug
bug
enhancement
pull-request
question
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/geodns#118
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/abh/geodns/pull/75
Author: @abligh
Created: 8/19/2015
Status: ❌ Closed
Base:
master← Head:fix-crash-on-enabling-previously-invalid-zone📝 Commits (4)
75f2193Fix race referencing config9ea0491Move last modified time out of zonec99b922Fix crash on removal of zonefile with invalid JSON (Issue #69)63f15b8Fix issue #74 - crash on reenabling previously invalid zone📊 Changes
8 files changed (+62 additions, -21 deletions)
View changed files
📝
config.go(+23 -1)📝
geodns.go(+2 -2)📝
geoip.go(+3 -2)📝
stathat.go(+7 -7)📝
zone.go(+15 -6)📝
zone_test.go(+4 -1)📝
zones.go(+6 -2)📝
zones_test.go(+2 -0)📄 Description
Fix issue #74
This crash is similar to #69 but with a different cause (and different fix)
To replicate:
dns/example.comso it is invalid (e.g. put anxat the top)geodnsdns/example.comso it is valid (e.g. remove the insertedx)geodnsto reloadexample.comdigquery for that zone e.g. todig A weight.example.com @....This produces a panic at:
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,
Metricsis initialised to{nil, nil, nil, nil}.SetupMetricsis 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,oldis non-nil, so the previousMetricsstructis copied, but not initialised, so it remainsnil. The fix (coming right up) is to initialise anynilmembers of theMetricsstruct whatever the value ofoldon entry.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.