Open rahul003 opened 3 years ago
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.
Could this happen if I have multiple instances of command in parallel?
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.
Alright, I think this might have happened
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 🤔.
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.
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)
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
@neugartf You might want to deactivate and change your access token as it's visible in the screenshot.
@rahul003 Thanks for the warning! 🤗
@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.
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