Repository navigation
Description
What happened
This was found by reading the code on main and is not reproduced here. #601 reported the symptoms on solidcommunity.net, which has Cloudflare in front of it, and was closed. The fixes proposed there (a per-pod pause after a rate limit, jittered retries, a test with a pod that rate-limits) did not land. As noted there, the JavaScript Solid Server rate-limits at 60 requests a minute.
Reads. A read fails with 429, 408, a 5xx or a network error. It is retried up to 3 times (main.tsx:43, retryable.ts:9), with TanStack Query's default delay of 1 s, 2 s and 4 s. That's about 7 s in all, with no randomness, and each query keeps its own count. So when a page's burst of reads gets rate-limited, every query retries on the same schedule, and the retries land in the next rate-limit window together.
The server's instructions. Nothing in the app reads Retry-After. A server that says "wait 60 s" gets three more requests within about 7 s, then the app gives up. There are two cases:
- The server sends CORS headers on its 429 and lists
Retry-AfterinAccess-Control-Expose-Headers. The app can see the status and the header, and it ignores the header. - The server or its proxy sends no CORS headers on the 429, as with Cloudflare in Lots of CORS and 429 errors on https://solidcommunity.net #601. The browser hands the app a network error with no status at all. The app can't tell a rate limit from a dropped connection, and so it can't wait any longer than for a blip.
Writes. No write is retried on 429 or 503:
- A grade's answer that fails waits in the queue until the next answer (answerStore.ts:89). So on a rate-limited pod, each grade sends a request again straight into the limit.
- Any other write fails at once.
What the learner sees. While the retries run, the screen just shows it is loading. Nothing says the server asked the app to slow down. When the retries run out, a 429 isn't an AppError, so it shows as common.unexpectedError (i18n.tsx:493): "Something went wrong. Try again, or reload the page. Details: …". The details are the raw HTTP error. Trying again or reloading at once sends another burst into the same limit.
Expected:
- The app waits as long as the server asks, where it can see the request (
Retry-After), and otherwise backs off with randomness. - One wait is shared by every request to that server, reads and writes alike.
- The learner is told the server is busy and that the app will try again on its own.
Steps to reproduce
- Log in with a pod on a server that rate-limits: solidcommunity.net (Cloudflare), or a JavaScript Solid Server at 60 requests a minute.
- Open the deck list of an instance with several decks, or study and grade quickly.
- In the browser's network tab, see 429s (or CORS errors, where the 429 has no CORS headers), each read retried 1 s, 2 s and 4 s later whatever the server's
Retry-Aftersays. - See the screen keep loading with no word about the server, then "Something went wrong" with the HTTP error as its details.
Where
The deck list, study, and any screen that reads or writes the pod
Version
Browser and system
No response
Pod
solidcommunity.net (Cloudflare rate limiting), or a JavaScript Solid Server
The app's language
English
Anything else
A possible fix, in the order it would land:
- One wait per server. A gate in the fetch chain of
solidthat every request to an origin passes through. After a 429 or 503, it pauses that origin forRetry-Afterwhen the response shows it (seconds or a date, capped), and otherwise for a jittered exponential backoff. A network error with no status during a burst counts as a possible rate limit. The gate makes reads and writes alike wait their turn, so the queries' own retries and the answer queue stop sending into the limit. - Limit how many requests go to one pod at once, as Lots of CORS and 429 errors on https://solidcommunity.net #601 proposed, so the burst that causes the limit is smaller.
- Tell the learner. While a server's wait lasts, the screen says something like "Your pod's server asked Solid Memo to slow down. Trying again in 40 s." Once retries run out, the error says the server is busy and that waiting helps, not "Something went wrong" with raw details. This needs a new
AppError(for examplepodBusy, with the server and the wait), translated in every locale. - A test with a pod that rate-limits, with and without CORS headers on its 429, so this doesn't come back.
Servers that want the app to honor Retry-After need to send CORS headers on the 429 and list Retry-After in Access-Control-Expose-Headers. That belongs in the interop docs (docs/testing.md) and in a note to server maintainers.
The pause between 412 tries is a separate issue, about write conflicts, not about the server's pace.
Activity