Skip to content

porkbun 503 rate limiting#911

Open
likeaninja5 wants to merge 4 commits intoqdm12:masterfrom
likeaninja5:master
Open

porkbun 503 rate limiting#911
likeaninja5 wants to merge 4 commits intoqdm12:masterfrom
likeaninja5:master

Conversation

@likeaninja5
Copy link
Copy Markdown
Contributor

When updating multiple domains after an ip change porkbun seems to have an issue with too many requests in a short period of time. I don't have much more info than that, since porkbun is returning a 5XX. Usually ddns-updater will only get 1 or 2 domains updated before erroring out on the rest.

I don't actually know go, so apologizes if something isn't following standards here.

Before change.

2025-01-12T20:28:22Z INFO Updating record [domain: domain.com | owner: owner1 | provider: porkbun | ip: ipv4] to use 123.123.123.123
2025-01-12T20:28:23Z INFO Updating record [domain: domain.com | owner: owner2 | provider: porkbun | ip: ipv4] to use 123.123.123.123
2025-01-12T20:28:24Z ERROR updating record: for record type A, record owner owner2 and record id record_id_1: HTTP status is not valid: 503: <html><head><title>503 Service Temporarily Unavailable</title></head><body><center><h1>503 Service Temporarily Unavailable</h1></center><hr><center>openresty</center></body></html>
2025-01-12T20:28:24Z INFO Updating record [domain: domain.com | owner: owner3 | provider: porkbun | ip: ipv4] to use 123.123.123.123
2025-01-12T20:28:24Z ERROR getting record IDs: for record type A and record owner owner3: HTTP status is not valid: 503: <html><head><title>503 Service Temporarily Unavailable</title></head><body><center><h1>503 Service Temporarily Unavailable</h1></center><hr><center>openresty</center></body></html>
2025-01-12T20:28:24Z INFO Updating record [domain: domain.com | owner: owner4 | provider: porkbun | ip: ipv4] to use 123.123.123.123
2025-01-12T20:28:24Z ERROR getting record IDs: for record type A and record owner owner4: HTTP status is not valid: 503: <html><head><title>503 Service Temporarily Unavailable</title></head><body><center><h1>503 Service Temporarily Unavailable</h1></center><hr><center>openresty</center></body></html>
2025-01-12T20:28:24Z INFO Updating record [domain: domain.com | owner: owner5 | provider: porkbun | ip: ipv4] to use 123.123.123.123
2025-01-12T20:28:24Z ERROR getting record IDs: for record type A and record owner owner5: HTTP status is not valid: 503: <html><head><title>503 Service Temporarily Unavailable</title></head><body><center><h1>503 Service Temporarily Unavailable</h1></center><hr><center>openresty</center></body></html>
2025-01-12T20:28:24Z INFO Updating record [domain: domain.com | owner: owner6 | provider: porkbun | ip: ipv4] to use 123.123.123.123
2025-01-12T20:28:24Z ERROR getting record IDs: for record type A and record owner owner6: HTTP status is not valid: 503: <html><head><title>503 Service Temporarily Unavailable</title></head><body><center><h1>503 Service Temporarily Unavailable</h1></center><hr><center>openresty</center></body></html>
2025-01-12T20:28:24Z INFO Updating record [domain: domain.com | owner: owner7 | provider: porkbun | ip: ipv4] to use 123.123.123.123
2025-01-12T20:28:24Z ERROR getting record IDs: for record type A and record owner owner7: HTTP status is not valid: 503: <html><head><title>503 Service Temporarily Unavailable</title></head><body><center><h1>503 Service Temporarily Unavailable</h1></center><hr><center>openresty</center></body></html>
2025-01-12T20:28:24Z INFO Updating record [domain: domain.com | owner: owner8 | provider: porkbun | ip: ipv4] to use 123.123.123.123
2025-01-12T20:28:24Z ERROR getting record IDs: for record type A and record owner owner8: HTTP status is not valid: 503: <html><head><title>503 Service Temporarily Unavailable</title></head><body><center><h1>503 Service Temporarily Unavailable</h1></center><hr><center>openresty</center></body></html>
2025-01-12T20:28:24Z INFO Updating record [domain: domain.com | owner: owner9 | provider: porkbun | ip: ipv4] to use 123.123.123.123
2025-01-12T20:28:24Z ERROR getting record IDs: for record type A and record owner owner9: HTTP status is not valid: 503: <html><head><title>503 Service Temporarily Unavailable</title></head><body><center><h1>503 Service Temporarily Unavailable</h1></center><hr><center>openresty</center></body></html>
2025-01-12T20:28:24Z INFO Updating record [domain: domain.com | owner: owner10 | provider: porkbun | ip: ipv4] to use 123.123.123.123
2025-01-12T20:28:25Z ERROR updating record: for record type A, record owner owner10 and record id record_id_2: HTTP status is not valid: 503: <html><head><title>503 Service Temporarily Unavailable</title></head><body><center><h1>503 Service Temporarily Unavailable</h1></center><hr><center>openresty</center></body></html>
2025-01-12T20:28:25Z INFO Updating record [domain: domain.com | owner: owner11 | provider: porkbun | ip: ipv4] to use 123.123.123.123
2025-01-12T20:28:25Z ERROR getting record IDs: for record type A and record owner owner11: HTTP status is not valid: 503: <html><head><title>503 Service Temporarily Unavailable</title></head><body><center><h1>503 Service Temporarily Unavailable</h1></center><hr><center>openresty</center></body></html>

After change:

2025-01-12T21:34:13Z INFO ipv4 address of owner1.domain.com is 123.123.123.123 and your ipv4 address  is 111.111.111.111
2025-01-12T21:34:14Z INFO ipv4 address of owner2.domain.com is 123.123.123.123 and your ipv4 address  is 111.111.111.111
2025-01-12T21:34:14Z INFO ipv4 address of owner3.domain.com is 123.123.123.123 and your ipv4 address  is 111.111.111.111
2025-01-12T21:34:14Z INFO ipv4 address of owner4.domain.com is 123.123.123.123 and your ipv4 address  is 111.111.111.111
2025-01-12T21:34:15Z INFO ipv4 address of owner5.domain.com is 123.123.123.123 and your ipv4 address  is 111.111.111.111
2025-01-12T21:34:15Z INFO ipv4 address of owner6.domain.com is 123.123.123.123 and your ipv4 address  is 111.111.111.111
2025-01-12T21:34:15Z INFO ipv4 address of owner7.domain.com is 123.123.123.123 and your ipv4 address  is 111.111.111.111
2025-01-12T21:34:15Z INFO ipv4 address of owner8.domain.com is 123.123.123.123 and your ipv4 address  is 111.111.111.111
2025-01-12T21:34:15Z INFO ipv4 address of owner9.domain.com is 123.123.123.123 and your ipv4 address  is 111.111.111.111
2025-01-12T21:34:15Z INFO ipv4 address of owner10.domain.com is 123.123.123.123 and your ipv4 address  is 111.111.111.111
2025-01-12T21:34:15Z INFO ipv4 address of owner11.domain.com is 123.123.123.123 and your ipv4 address  is 111.111.111.111
2025-01-12T21:34:16Z INFO ipv4 address of owner12.domain.com is 123.123.123.123 and your ipv4 address  is 111.111.111.111
2025-01-12T21:34:16Z INFO Updating record [domain: domain.com | owner: owner1 | provider: porkbun | ip: ipv4] to use 111.111.111.111
2025-01-12T21:34:18Z INFO Updating record [domain: domain.com | owner: owner2 | provider: porkbun | ip: ipv4] to use 111.111.111.111
2025-01-12T21:34:20Z INFO Updating record [domain: domain.com | owner: owner3 | provider: porkbun | ip: ipv4] to use 111.111.111.111
2025-01-12T21:34:22Z INFO Updating record [domain: domain.com | owner: owner4 | provider: porkbun | ip: ipv4] to use 111.111.111.111
2025-01-12T21:34:25Z INFO Updating record [domain: domain.com | owner: owner5 | provider: porkbun | ip: ipv4] to use 111.111.111.111
2025-01-12T21:34:27Z INFO Updating record [domain: domain.com | owner: owner6 | provider: porkbun | ip: ipv4] to use 111.111.111.111
2025-01-12T21:34:29Z INFO Updating record [domain: domain.com | owner: owner7 | provider: porkbun | ip: ipv4] to use 111.111.111.111
2025-01-12T21:34:32Z INFO Updating record [domain: domain.com | owner: owner8 | provider: porkbun | ip: ipv4] to use 111.111.111.111
2025-01-12T21:34:35Z INFO Updating record [domain: domain.com | owner: owner9 | provider: porkbun | ip: ipv4] to use 111.111.111.111
2025-01-12T21:34:37Z INFO Updating record [domain: domain.com | owner: owner10 | provider: porkbun | ip: ipv4] to use 111.111.111.111
2025-01-12T21:34:40Z INFO Updating record [domain: domain.com | owner: owner11 | provider: porkbun | ip: ipv4] to use 111.111.111.111
2025-01-12T21:34:42Z INFO Updating record [domain: domain.com | owner: owner12 | provider: porkbun | ip: ipv4] to use 111.111.111.111


for _, record := range records {
err = p.updateRecord(ctx, client, recordType, p.owner, ipStr, record.ID)
time.Sleep(time.Second)
Copy link
Copy Markdown
Collaborator

@bentemple bentemple Jan 14, 2025

Choose a reason for hiding this comment

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

I ran into this too.

One thing, is that if we're getting rate-limited, likely adding the same sleep delay here won't solely fix the underlying issue. This fixes it for lots of subdomains under the same hostname, but if you have DDNS-updater setup to do lots of different hostnames, you can also run into rate-limiting (as I have encountered).

@qdm12 any thoughts on how you'd want this fixed? Maybe wrap the HTTP client to have a general http request rate limit, either per host, or globally. Would that make sense to you? In my mind, you'd ideally be able to specify a max requests per period for a given provider or globally, and the http client would automatically handle queuing and staying within that request limit.

Copy link
Copy Markdown
Collaborator

@bentemple bentemple Jan 14, 2025

Choose a reason for hiding this comment

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

This also might be pretty unique to porkbun and we'd just want to setup a porkbun ratelimiter, though I could see it being an issue for any DNS provider during the update step.

@qdm12
Copy link
Copy Markdown
Owner

qdm12 commented Apr 12, 2026

@likeaninja5 @bentemple are you sure this is rate limiting? 503 is not 429, it's a bit odd. Does it still happen today? There is already a cooldown mechanism in place when one gets banned that works for all providers, we could also use it here. Right now it's hardcoded to 1h, but we could have it configurable or as a constant depending on the provider. What's the cooldown, just one second??

const banPeriod = time.Hour
isWithinBanPeriod := record.LastBan != nil && now.Sub(*record.LastBan) < banPeriod
if isWithinBanPeriod {
s.logger.Info(fmt.Sprintf(
"record %s is within ban period of %s started at %s, skipping update",
recordToLogString(record), banPeriod, *record.LastBan))
return false
}

We could alternatively have an http client for porkbun that sleeps 1 second after each request.

@qdm12 qdm12 changed the title Added delay to dns porkbun dns update to prevent errors porkbun 503 rate limiting Apr 12, 2026
@qdm12
Copy link
Copy Markdown
Owner

qdm12 commented Apr 12, 2026

If you turn on debug log level, do you get any of these in the response http headers: X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants