Skip to content

fix(p/LUADNS): bug: occasional "Server returned bad status code (500)" fails a push - #5041

Closed
TomOnTime wants to merge 1 commit into
mainfrom
tlim_luadns_svcb
Closed

TomOnTime wants to merge 1 commit into
mainfrom
tlim_luadns_svcb

Conversation

@TomOnTime

Copy link
Copy Markdown
Collaborator

Problem

Integration tests on LUADNS occasionally fail with a 500:

± MODIFY ***-luadns.com HTTPS (3 example.com. alpn="h2,h3" port="999" ech="some+base64+encoded+value///" ttl=300) -> (3 example.com. alpn="h2" port="80" ech="some+base64+encoded+value///" ttl=300)
Server returned bad status code (500)

Cause

The payload appears valid: reproducing test 19 locally produces 3 example.com. alpn=h2 port=80 ech=some+base64+encoded+value///, which has the same shape as test 18's PATCH that succeeds with the same ECH value. Since the content we send is deterministic and the failure is intermittent, this looks like a transient server-side error. (luadns-go discards the 500 response body, so the server's reason isn't visible.)

Fix

New providers/luadns/retry.go, following the policy in providers/mittwald/retry.go:

  • 429: every request is retried (it wasn't processed).
  • 500/502/503/504: requests that can't create anything twice (updates, deletes, reads) are retried with a doubling pause (2s, 4s, …, capped at 30s; up to 6 retries).
  • Creates (POST: records and zones): not retried after a 5xx, since the first attempt may have succeeded and a retry could duplicate it.

All LuaDNS API calls now go through the helper, which also does the rate-limiter wait.

Testing

  • New retry_test.go covers the retry/no-retry cases.
  • go test ./providers/luadns passes; go build ./... passes.
  • Not yet re-run against the live LuaDNS integration tests.

🤖 Generated with Claude Code

…fails a push

The LuaDNS API occasionally answers a valid request with a 5xx. Repeat
requests that cannot create anything twice (updates, deletes, reads)
after a 500/502/503/504, with a doubling pause. Repeat every request
after a 429. Creates (POST) are not repeated after a 5xx, since the
first attempt may have succeeded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@TomOnTime

Copy link
Copy Markdown
Collaborator Author

@riku22

The integration tests were failing occasionally. I asked Claude to take a look, and it concluded the 500s were LUA's fault, not ours. It suggested retrying 500s and wrote this solution, which seems rather large for a small problem.

I asked it to create a smaller solution. It created #5042 which isn't as clean but doesn't rewrite the entire retry mechanism.

I'm ok with either solution. As the maintainer, do you have a preference?

@TomOnTime TomOnTime changed the title fix(LUADNS): bug: occasional "Server returned bad status code (500)" fails a push fix(p/LUADNS): bug: occasional "Server returned bad status code (500)" fails a push Oct 26, 2026
@riku22

riku22 commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Thank you.

Since there are few corrections needed, #5042 seems like a better choice.

TomOnTime added a commit that referenced this pull request Oct 27, 2026
…" fails a push (#5042)

## Problem

Integration tests on LUADNS occasionally fail with a 500 on a valid
update:

```
± MODIFY ***-luadns.com HTTPS (3 example.com. alpn="h2,h3" port="999" ech="some+base64+encoded+value///" ttl=300) -> (3 example.com. alpn="h2" port="80" ech="some+base64+encoded+value///" ttl=300)
Server returned bad status code (500)
```

The payload is deterministic and the same shape succeeds in the previous
test step, so this looks like a transient server-side error.

## Fix

A small `retry500` helper in `luadnsProvider.go` retries a request up to
3 times (pausing 2s, then 4s) when the API returns a 500. It is used
only for `UpdateManyRecords` and `DeleteManyRecords`, which are safe to
repeat. Creates are not retried, since the first attempt may have
succeeded.

This is a smaller alternative to #5041 (no new files; no 429 / other 5xx
handling; reads untouched).

## Testing

- `go test ./providers/luadns` passes.
- Not yet re-run against the live LuaDNS integration tests.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@TomOnTime TomOnTime closed this Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants