fix: set pulp-api --max-requests to 5000 to prevent OOM#1163
Merged
Conversation
Without an explicit --max-requests, pulp-api workers accumulate memory indefinitely due to a leak (~60 MiB/hr), causing OOMKilled events. Set --max-requests=5000 (jitter 500) to recycle workers before they exhaust the 5120 MiB limit while keeping counter values high enough for reliable Prometheus counter reset detection in SLO metrics. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
Reviewer's guide (collapsed on small PRs)Reviewer's GuideConfigures pulp-api Gunicorn workers to recycle after ~5000 requests with jitter to mitigate a memory leak and prevent OOMs while preserving SLI accuracy, by wiring new max-requests settings into the deployment manifest as parameters and command-line flags. Flow diagram for Gunicorn worker lifecycle with max-requests and jitterflowchart TD
Start[Worker start] --> Init[Initialize request_count to 0<br>Load max_requests from PULP_API_GUNICORN_MAX_REQUESTS<br>Load jitter from PULP_API_GUNICORN_MAX_REQUESTS_JITTER]
Init --> ComputeLimit[Compute effective_limit = max_requests + random_jitter]
ComputeLimit --> WaitReq[Wait for next HTTP request]
WaitReq --> HandleReq[Handle request]
HandleReq --> IncCount[Increment request_count]
IncCount --> CheckLimit{request_count >= effective_limit?}
CheckLimit -->|No| WaitReq
CheckLimit -->|Yes| GracefulShutdown[Finish in-flight work and shut down worker]
GracefulShutdown --> WorkerRestart[Master starts replacement worker]
WorkerRestart --> Start
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
After removing the explicit
--max-requests=20override (which was causing SLI histogram corruption), pulp-api workers rely on pulpcore's default. However, there is a memory leak (~60 MiB/hr) that causes workers to grow from ~850 MiB to 3.8+ GiB within 24 hours, resulting in OOMKilled events (observed on podpulp-api-5864b7b559-zfczhat 2026-04-29T00:01:41Z).Fix
Set
--max-requests=5000(jitter 500) explicitly on the pulp-api command. This:Test plan
APIWriteRequestLatencySLI stays ≤ 1 and no OOMKilled events🤖 Generated with Claude Code
Summary by Sourcery
Configure pulp-api Gunicorn workers to recycle after a bounded number of requests to mitigate memory growth and OOM events while preserving metrics accuracy.
Enhancements: