Repository navigation
Kafka Producer Leak Causing Broker OOM on Astronomy Shop - #935
Merged
Merged
Conversation
* Add mutating_webhook_resource_limits problem * Add mutating_webhook_resource_limits to Problem List * mutating_webhook_resource_limits problem docstring fix Removed incorrect information about mitigation options. * Additions to mutating_webhook_limits_resource_limits problem - Memory limit/request patching before activating the webhook - Decoy pods for increased complexity * More additions to mutating_webhook problem - Make decoys realisticly named - Similar minor changes --------- Co-authored-by: Saad Mohammad Rafid Pial <[email protected]>
* add the the probem redundency * base. * the fixed and dynamic app name are fixed. hte namespace are also fixed. * unessessry formating is reverted. * unessessry formating is reverted. * formating correction. * formating correction. * formating correction. * add fault injection decorator markers to test_problem_bsae.py --------- Co-authored-by: Saad Mohammad Rafid Pial <[email protected]>
* add file_descriptor_exhaustion problem * Modify fault injection and recovery methods * Fix fault recovery * Change fault injection method Add fault injection by flooding connections * Update fault injection method and add custom oracle --------- Co-authored-by: Saad Mohammad Rafid Pial <[email protected]>
* finalizzer code is reaoslve dadlock benchmark. * yaml file corrected. * reverting hte comments back to their place. * read only rbac * controller log is generalized and avoiding any sregym related name exposing. * applied ruff linter formatter accordingly. * replace metadata naming and includding all the oprations on mitigation side. --------- Co-authored-by: Saad Mohammad Rafid Pial <[email protected]>
…EGym#851) * Add secret rotation stale env credentials problem * Simplify secret rotation mitigation oracle checks * Require rotated PostgreSQL in oracle * Fix stale DB credential rotation shortcuts - Remove old password from postgresql-init ConfigMap - Keep PostgreSQL password rotation durable after pod restart - Reject mitigations that revert otelu to the old password - Remove old password leaks from unrelated pods * Fix fault recovery to satisfy the oracle * Fix problem registry import ordering --------- Co-authored-by: Saad Mohammad Rafid Pial <[email protected]>
…REGym#886) * Add cumulative_admission_webhook_timeout_hotel_reservation problem * Pin webhook backends to worker nodes via nodeAffinity * Make webhook backends realistic admission services Replace the dummy webhook backends with HTTPS admission servers that terminate TLS using Secret-mounted certificates, validate AdmissionReview requests, and return proper admission responses. Certificates are signed by the same CA referenced in each webhook's `caBundle`, with SANs covering the backend Service DNS names. The admission logic enforces a trusted image registry allowlist and a per-container CPU limit. All Hotel Reservation workloads satisfy these policies, so the webhooks remain transparent during normal operation and recovery. Also: * Vary webhook `timeoutSeconds` (12, 8, 11, 9) to make the cumulative timeout less obvious. * Rename the CA CN from `sregym-webhook-ca` to `compliance-webhook-ca`. * Remove a duplicate `rule.from_` check in the oracle. * Fix create-or-replace handling for webhooks, NetworkPolicies, Deployments, and Services so re-injection updates existing resources instead of failing or silently skipping changes. * Model the fault as a missing apiserver NetworkPolicy allow * Model the fault as a missing apiserver allow with a near-miss policy --------- Co-authored-by: Saad Mohammad Rafid Pial <[email protected]>
Labelling a namespace pod-security.kubernetes.io/enforce=restricted leaves running pods untouched but makes the apiserver reject recreated pods that run as root / set no seccomp profile, so a deployment silently goes under-replicated. Unlike the existing webhook problems, the policy is enforced by the apiserver via a namespace label, not a webhook config.
* add copilot cli agent * remove -s flag
* fix(mcp): broaden MCP retry exceptions and return error instead of raising * fix(ci): strip CRLF from PR description before parsing problem ID
* Fix custom kind cluster detection * Handle failed kind detection output
* Support local LLM endpoints for Stratus * Prefer env vars for local LLM endpoints * Support local LLM endpoints for OpenCode * Route local endpoints into agent containers * Normalize OpenCode local judge models --------- Co-authored-by: Saad Mohammad Rafid Pial <[email protected]>
* add support for ATIF trajectory conversion and normalization, add claudecode adapter * fix: make _finish_problem idempotent * isolate .codex mount in container runner * better temp dir cleanup * add codex adapter * add opencode adapter * add copilot adapter * add stratus adapter * fix antropic caching for stratus * add gemini adapter * store normalized ATIF trajectories in SQLite indexed by problem type * edge tests * bump litellm, tikoken * update docker lib versions
* adding clock drift problem * fixing race condition causing sidecar log delay * fixing recover_fault to reverse time sync removal applied, improve cleanup * global cleanup added + fixed restoration for node_clock_drift problem * fixing mitigation oracle to ensure correct node checked * adding problem to non emulated cluster problems list * extending wait * indentation error fix * fixing time restoration in global cleanup * adding in check to make sure it picks worker node * adding another control plane filter, fixing clock step-back in global recovery * increase sidecar rollout timeout, make podnames/labels generic, idempotancy check * formatting fixes * format fix * fix * fix ruff check/format issues --------- Co-authored-by: Saad Mohammad Rafid Pial <[email protected]>
Finished Kafka producer leak problem
Saadmrp1038
self-requested a review
July 14, 2026 02:42
Saadmrp1038
requested changes
Jul 16, 2026
Saadmrp1038
left a comment
Collaborator
There was a problem hiding this comment.
@vsmart-06 Thanks for the effort! I left some inline comments below. Mainly about oracle behavior and fault injection handling. Please ping me when you have addressed them.
Saadmrp1038
requested changes
Jul 19, 2026
Saadmrp1038
left a comment
Collaborator
There was a problem hiding this comment.
Most of the issues I mentioned before are now fixed. Only two nits about the large sleep values remain. We should poll instead whenever possible.
Collaborator
|
Works great now! |
Saadmrp1038
approved these changes
Jul 22, 2026
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.
Implements #867
This PR adds a new SREGym problem,
kafka_producer_leak, inspired by a real PagerDuty incident where excessive Kafka producer creation caused broker heap exhaustion.Real-World Failure Story
Postmortem link: https://www.pagerduty.com/eng/august-28-kafka-outages-what-happened-and-how-were-improving/
In August 2025, PagerDuty experienced a major platform outage caused by a Kafka producer leak. A new feature introduced a bug where a fresh Kafka producer was instantiated per API request rather than reusing a shared instance. At peak traffic this generated millions of producer connections per hour. The Kafka broker's JVM heap filled up tracking metadata for all these producers, triggering garbage collection thrashing and eventually full broker unavailability. Since Kafka was central to nearly every async operation at PagerDuty, the outage cascaded platform-wide. Critically, an initial mitigation that simply restarted the broker failed because the leaking producers immediately re-exhausted memory - the root cause had to be addressed directly.
How the failure is simulated on SREGym
The problem targets the checkout deployment in the astronomy-shop namespace.
Fault injection
The concurrent large-message sends exhaust the broker's JVM heap through network receive buffer allocation pressure, triggering an OOMKill.
Recovery removes the sidecar and reverts KAFKA_MESSAGE_MAX_BYTES, then force-deletes the old checkout pod to break the rolling update deadlock caused by the broker being unavailable during the update.
Problem runtime behavior and mitigation oracle
After injection, the Kafka broker OOMKills repeatedly (exit code 137). The same behaviour may be observed in the accounting and fraud-detection pods as well. The order-creator sidecar logs show hundreds of concurrent librdkafka producer instances terminating simultaneously with undelivered 10MB messages, directly implicating the sidecar as the cause.
The mitigation oracle (KafkaProducerLeakOracle) inherits MitigationOracle and additionally checks that the order-creator container is absent from the checkout deployment spec and that the broker pod is healthy.
The canonical mitigation is removing the order-creator sidecar from the checkout deployment.
Notes
/validate-problem kafka_producer_leak