Repository navigation
fix(requestreply): unregister the request on an early return - #9518
arpitjain099 wants to merge 1 commit into
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: arpitjain099 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Welcome @arpitjain099! It looks like this is your first PR to knative/eventing 🎉 |
|
Hi @arpitjain099. Thanks for your PR. I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with Tip We noticed you've done this a few times! Consider joining the org to skip this step and gain Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the request-cleanup change.
No open issues 🎉
What changed in this PR
Fixes a memory leak in the RequestReply ingress by ensuring registered requests are removed when handleNewEvent returns, including on early errors.
Changes:
- Defers request cleanup immediately after registration, replacing cleanup calls in individual return paths.
- Adds a regression test verifying that five failed dispatches leave no registered requests.
| File | Description |
|---|---|
pkg/requestreply/ingress_handler.go |
Ensures request cleanup runs on every return. |
pkg/requestreply/ingress_handler_test.go |
Tests that dispatch failures do not retain registered requests. |
Review effort: Balanced
This change was written with the assistance of generative AI. I have reviewed and understand every change in it. Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
ea6635f to
016a0b4
Compare
handleNewEventregisters the event inh.entriesfirst, then four error paths return without callingdeleteEvent: no broker address annotation, no AES key, a correlation id failure, a dispatch failure. Each one leaves aproxiedRequestholding the request's ResponseWriter in the map for the life of the pod. Only the reply and timeout paths clean up.Moving the cleanup into a
deferafteraddEventcovers every return. The new test posts five events at a broker that is not listening: 5 entries are left behind before the change, 0 after.Proposed Changes
defer, so every return fromhandleNewEventremoves it fromh.entriesPre-review Checklist
Release Note
This change was written with the assistance of generative AI. I have reviewed and understand every change in it.