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

Multiple A records being created for same subdomain #18

Open
rahul003 opened this issue Aug 18, 2021 · 11 comments
Open

Multiple A records being created for same subdomain #18

rahul003 opened this issue Aug 18, 2021 · 11 comments

Comments

@rahul003
Copy link

rahul003 commented Aug 18, 2021

How do I prevent multiple records from being created? I'm running like this. This only happens some times. Unable to figure out when it replaces the IP vs when it creates a new entry

NDDNS_IPv6_ENABLED=false /sgt/projects/dyndns/nddns_Linux_Arm64 --accesstoken `cat /sgt/projects/dyndns/netlify.key` --zone $DOMAIN.com --record $rec --interval 0

@rahul003 rahul003 changed the title Multiple A records being created Multiple A records being created for same subdomain Aug 18, 2021
@oscartbeaumont
Copy link
Owner

I am unable to reproduce this, if you can provide an example set of commands that can reproduce it I can have a look overwise from my end everything seems to be working fine.

@rahul003
Copy link
Author

Could this happen if I have multiple instances of command in parallel?

@oscartbeaumont
Copy link
Owner

I am fairly certain multiple instances could result in this behaviour, however they would have to be pointing at the same zone and record. This however is a limitation of Netlify.

The technical explanation as to why is that Netlify DNS records are idempotent (can't be changed), hence this project finds and delete the old record and then creates a new one every time it detects your IP address has changed. Theoretically, if you had two instances of the app running at the same time and they ran the update at the same time (highly unlikely but possible) they could run both send the delete command (although one of them would possibly fail) and then both create a new record.

@rahul003
Copy link
Author

Alright, I think this might have happened

@neugartf
Copy link

neugartf commented Sep 27, 2021

I must say, I also ran into this with the v3.x. Started a cron with a new reboot so I'm quite confident that there was just one instance running 🤔.
image

@oscartbeaumont
Copy link
Owner

Can you see anything in the console output of netlify-dynamic-dns? Maybe a network failure is occurring or something, I'm not sure. Without being able to reproduce this reliably makes it hard to fix.

@neugartf
Copy link

neugartf commented Sep 27, 2021

Just checkd my syslog. Doesn't seem to look like they is an error. TBH I'm not too sure if this would logged anyway. I actually had a cron every 5 minutes, not after reboot. Sorry!

CRON[21968]: (pi) CMD (/usr/local/bin/nddns -accesstoken *** -zone neugartf.com -record string -ipv6=false)

@neugartf
Copy link

neugartf commented Sep 27, 2021

I had a closer look, but didn't find anything either (neither in their API nor your code)

What I see might be a general issue, is sanitizing the input args:
/usr/local/bin/nddns -accesstoken *** -zone " neugartf.com" -record matrix -ipv6=false
I was able to create an infinite loop by adding a white space to the zone
image

@rahul003
Copy link
Author

rahul003 commented Sep 27, 2021

@neugartf You might want to deactivate and change your access token as it's visible in the screenshot.

@neugartf
Copy link

@rahul003 Thanks for the warning! 🤗

@oscartbeaumont
Copy link
Owner

@neugartf I don't do any validation of the arguments so that I don't introduce any issues if my validation logic doesn't match Netlify's but when I get some time I might make the app exit if the first update upon startup fails. This should prevent the loop as you have found above and act as a way to use Netlify to validate the arguments.
I have stopped using this project (due to not having firewall access where I currently live) but when I get a minute I will add detailed logging and see if I can deploy it somewhere as it might help to determine what is causing this issue. If you are interested in fixing it yourself have a look over the codebase. If anyone has a look at the code and has any questions feel free to ask them here or send me an email.

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

No branches or pull requests

3 participants