Skip to content

fix(nats sink): fix vector exiting if nats sink url fails dns resolution or is unavailable without --require-healthy #23167

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

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

rdwr-tomers
Copy link
Contributor

Summary

Change Type

  • Bug fix
  • New feature
  • Non-functional (chore, refactoring, docs)
  • Performance

Is this a breaking change?

  • Yes
  • No

How did you test this PR?

Running vector with a nats sink url pointing at an unavailable host, before the fix, results in vector exiting immediately.

For example, if the url points at a hostname that fails dns resolution the error logged is:
ERROR vector::topology::builder: Configuration error. error=Sink "nats": NATS Connect Error: DNS error: failed to lookup address information: Temporary failure in name resolution

After the fix, vector logs the same error, but continues on to try and reconnect to the NATS server. When the server becomes available, vector establishes the connection and resumes operation.

If vector is launched with --require-healthy flag it does exit on error connecting to NATS.

Does this PR include user facing changes?

  • Yes. Please add a changelog fragment based on our guidelines.
  • No. A maintainer will apply the "no-changelog" label to this PR.

Notes

  • Please read our Vector contributor resources.
  • Do not hesitate to use @vectordotdev/vector to reach out to us regarding this PR.
  • The CI checks run only after we manually approve them.
    • We recommend adding a pre-push hook, please see this template.
    • Alternatively, we recommend running the following locally before pushing to the remote branch:
      • cargo fmt --all
      • cargo clippy --workspace --all-targets -- -D warnings
      • cargo nextest run --workspace (alternatively, you can run cargo test --all)
      • ./scripts/check_changelog_fragments.sh
  • After a review is requested, please avoid force pushes to help us review incrementally.
    • Feel free to push as many commits as you want. They will be squashed into one before merging.
    • For example, you can run git merge origin master and git push.
  • If this PR introduces changes Vector dependencies (modifies Cargo.lock), please
    run cargo vdev build licenses to regenerate the license inventory and commit the changes (if any). More details here.

References

@rdwr-tomers rdwr-tomers requested a review from a team as a code owner June 9, 2025 07:18
@github-actions github-actions bot added the domain: sinks Anything related to the Vector's sinks label Jun 9, 2025
@rdwr-tomers rdwr-tomers requested a review from pront June 11, 2025 10:41
@@ -0,0 +1,3 @@
Fixed crash if nats sink url is unresolvable or unavailable even when --require-healthy is not set.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Fixed crash if nats sink url is unresolvable or unavailable even when --require-healthy is not set.
The `nats` sink now does not return an error when an unresolvable or unavailable URL is provided. Note that if `--require-healthy` is set then Vector will stop on startup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain: sinks Anything related to the Vector's sinks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nats sink trigger a crash with Configuration error Connection refused (os error 111)
2 participants