StackExchange / dnscontrol

Infrastructure as code for DNS!
https://dnscontrol.org/
MIT License
3.04k stars 381 forks source link

Porkbun does not work concurrently (`ppreview`) #2995

Open Syntaxheld opened 1 month ago

Syntaxheld commented 1 month ago

Describe the bug Testing the new concurrency feature (ppreview) on domains handled by the Porkbun provider it fails to handle those:

INFO#1: Zone "example.com" does not exist. Can not create because "porkbun" does not implement ZoneCreator

But the zone exists ... all works well when running the normal preview.

To Reproduce

  1. Have (multiple) domains in dnscontrol setup that use Porkbun
  2. dnscontrol ppreview --cmode all
  3. Multiple Zone "example.com" does not exist. Can not create because "porkbun" does not implement ZoneCreator issues.

Expected behavior For Porkbun to work concurrently.

DNS Provider

Additional context Tested with dnscontrol v4.11.0.

I've checked the "Concurrency Verified" column in https://docs.dnscontrol.org/getting-started/providers ... but I was not sure if the ❌ means "verified & failed" or "not verified".

At least in my testing, when I use dnscontrol ppreview --cmode all --domains example1.com,example2.com it still works (most of the time). It only starts throwing issues regularly when I test it with at least 3 different zones.

CC @imlonghao (maintainer of the porkbun provider)

imlonghao commented 1 month ago

I was not sure if the ❌ means "verified & failed" or "not verified".

For Porkbun, it means "not verified" yet.

Zone "example.com" does not exist.

This error was caused by a missing error catch for JSON parsing, the real error message should be the follow, I will fill a PR for this.

failed parsing nameserver list from porkbun: invalid character '<' looking for beginning of value

https://github.com/StackExchange/dnscontrol/blob/32fe2753d81a681156dae5453f3b3724f30d70aa/providers/porkbun/api.go#L157

I'm not sure whether they have a hidden rate limit or something, in my test, when there are more than 3 domains in concurrently, an HTTP 503 error was thrown.

<html>
<head><title>503 Service Temporarily Unavailable</title></head>
<body>
<center><h1>503 Service Temporarily Unavailable</h1></center>
<hr><center>openresty</center>
</body>
</html>

I will contact the support for this, asking whether they have a rate limit or just the server crashed.

imlonghao commented 1 month ago

I got a response from Porkbun support.

The rate limit is 1 request per second.

So the Porkbun provider is not supposed to work concurrently.

tlimoncelli commented 1 month ago

1 per second? wow, that's pretty low.

It might be useful to implement a re-try on 429 (if porkbun sends a proper 429 when the rate limit is exceeded). Even without concurrency it is possible that we would exceed that limit.