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

[Bug] Misleading error message while processing dns.extra_records_path #2290

Closed
2 of 4 tasks
nblock opened this issue Dec 14, 2024 · 0 comments · Fixed by #2298
Closed
2 of 4 tasks

[Bug] Misleading error message while processing dns.extra_records_path #2290

nblock opened this issue Dec 14, 2024 · 0 comments · Fixed by #2298
Labels
bug Something isn't working DNS
Milestone

Comments

@nblock
Copy link
Collaborator

nblock commented Dec 14, 2024

Is this a support request?

  • This is not a support request

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Headscale prints an error message about unmarshalling records from dns.extra_records_path even though records are processed and streamed to nodes just fine.

Expected Behavior

Only print an error message when something went wrong permanently and cannot be recovered. Essentially transient errors happening while the file is written should be hidden. A user with the default log level has the impression that something is broken.

Steps To Reproduce

  1. Set dns.extra_records_path to some path
  2. Write to the file with: echo '[{"name":"grafana.myvpn.example.com","type":"A","value":"100.64.0.1"}]' | jq -cS > .headscale-dns/extra.json. Using this command triggers the error message reliably while headscale processes the changes correctly.
  3. Headscale logs:
2024-12-14T19:28:11+01:00 TRC ../runner/work/headscale/headscale/hscontrol/dns/extrarecords.go:87 > extra records received filewatch event op=WRITE path=.headscale-dns/extra.json
2024-12-14T19:28:11+01:00 ERR ../runner/work/headscale/headscale/hscontrol/dns/extrarecords.go:115 > reading extra records from path: .headscale-dns/extra.json error="unmarshalling records, content: \"\": unexpected end of JSON input"
2024-12-14T19:28:11+01:00 TRC ../runner/work/headscale/headscale/hscontrol/dns/extrarecords.go:87 > extra records received filewatch event op=WRITE path=.headscale-dns/extra.json
2024-12-14T19:28:11+01:00 TRC ../runner/work/headscale/headscale/hscontrol/dns/extrarecords.go:134 > extra records updated from path, count old: 1, new: 1 records=[{"Name":"grafana.myvpn.example.com","Type":"A","Value":"100.64.0.2"}]
2024-12-14T19:28:11+01:00 TRC ../runner/work/headscale/headscale/hscontrol/poll.go:644 > received stream update: StateFullUpdate  node=n1 node.id=1 omitPeers=false readOnly=false stream=true
2024-12-14T19:28:11+01:00 TRC ../runner/work/headscale/headscale/hscontrol/poll.go:644 > Sending Full MapResponse node=n1 node.id=1 omitPeers=false readOnly=false stream=true
2024-12-14T19:28:11+01:00 TRC finished writing mapresp to node mkey=mkey:94b730090613b46fe0f4a0a51518c2a585c63641a25a24ec419881be55015b0d node=n1 timeSpent=0.095543
2024-12-14T19:28:11+01:00 TRC ../runner/work/headscale/headscale/hscontrol/poll.go:644 > update sent node=n1 node.id=1 omitPeers=false readOnly=false stream=true

Environment

- OS: Arch
- Headscale version: 0.24.0-beta.1
- Tailscale version: -

Runtime environment

  • Headscale is behind a (reverse) proxy
  • Headscale runs in a container

Anything else?

No response

@nblock nblock added the bug Something isn't working label Dec 14, 2024
@nblock nblock changed the title [Bug] Misleading error message when reading from dns.extra_records_path [Bug] Misleading error message while processing dns.extra_records_path Dec 14, 2024
@kradalby kradalby added the DNS label Dec 15, 2024
@kradalby kradalby added this to the v0.24.0 milestone Dec 15, 2024
kradalby added a commit to kradalby/headscale that referenced this issue Dec 15, 2024
Fixes juanfont#2290

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
kradalby added a commit to kradalby/headscale that referenced this issue Dec 15, 2024
Fixes juanfont#2290

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
kradalby added a commit that referenced this issue Dec 16, 2024
* Fix excess error message during writes

Fixes #2290

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>

* retry filewatcher on removed files

This should handled if files are deleted and added again, and for rename
scenarios.

Fixes #2289

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>

* test more write and remove in filewatcher

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>

---------

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working DNS
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants