Skip to content

Cap auction list page size to stop OOM kills - #1630

Open
OlegPhenomenon wants to merge 3 commits into
masterfrom
fix-auction-list-page-size-limit
Open

OlegPhenomenon wants to merge 3 commits into
masterfrom
fix-auction-list-page-size-limit

Conversation

@OlegPhenomenon

Copy link
Copy Markdown
Contributor

show_all=true set the pagy limit to the full result count, so one request rendered every active auction. A row costs ~266KB of transient objects (~2970 allocations), measured in staging: 13MB for 50 rows, ~260MB for 1000. With a 450Mi container limit and puma running 5 threads, clicking "show all" and then sorting killed the process (exit 137, OOMKilled) and the ingress answered 503.

per_page was also unbounded and crashed with 500 on non-numeric input, because params[:per_page] is a String and String#zero? does not exist.

Clamp both paths to MAX_PAGE_LIMIT and fall back to the default page size for junk input. This also drops the duplicate COUNT query that the controller ran before pagy did its own.

show_all=true set the pagy limit to the full result count, so one request
rendered every active auction. A row costs ~266KB of transient objects
(~2970 allocations), measured in staging: 13MB for 50 rows, ~260MB for 1000.
With a 450Mi container limit and puma running 5 threads, clicking "show all"
and then sorting killed the process (exit 137, OOMKilled) and the ingress
answered 503.

per_page was also unbounded and crashed with 500 on non-numeric input,
because params[:per_page] is a String and String#zero? does not exist.

Clamp both paths to MAX_PAGE_LIMIT and fall back to the default page size
for junk input. This also drops the duplicate COUNT query that the
controller ran before pagy did its own.
bundler-audit flagged rubyzip 3.1.0 (path traversal, GHSA-47m2-wp7j-p9vc,
fixed in 3.4.0). It is a transitive dependency of selenium-webdriver
(rubyzip >= 1.2.2, < 4.0), so only the lockfile entry changes.
@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Deploy Complete!

Property Value
App auction
Slot 1
URL https://auction1-dev.cloud.tld.ee
Namespace auction1-dev

(Environment ready for testing)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant