-
Notifications
You must be signed in to change notification settings - Fork 10
agents: fix infinite recursion on ~CommandStream #412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: node-v24.x-nsolid-v6.x
Are you sure you want to change the base?
Conversation
WalkthroughAdds a destruction-aware flag to CommandStream that suppresses observer notifications during teardown and updates cancellation ordering; also adds a test validating agent reconnection after an initial invalid NSOLID_GRPC and subsequent CommandStream behavior. Changes
Sequence Diagram(s)(omitted — changes are localized and do not introduce a multi-component sequential flow warranting a diagram) Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
🧰 Additional context used🧠 Learnings (1)📚 Learning: 2025-12-03T14:35:32.707ZApplied to files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
🔇 Additional comments (2)
✏️ Tip: You can disable this entire section by setting Comment |
When trying to reset a CommandStream because of reasons: for example, we change `grpc` endpoint dynamically, we can enter an infinite recursion calling `GrpcAgent::reset_command_stream()` because when calling `~CommandStream()` the `OnDone()` callback may call the observer (GrpcAgent instance) which in turn would call `GrpcAgent::reset_command_stream()`. Avoid this recursion by adding a new `cancelling_for_destruction_` member variable to `CommandStream` which allows avoiding calling the observer if triggered by the destructor.
1820255 to
c4554c9
Compare
EHortua
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.



When trying to reset a CommandStream because of reasons: for example, we change
grpcendpoint dynamically, we can enter an infinite recursion callingGrpcAgent::reset_command_stream()because when calling~CommandStream()theOnDone()callback may call the observer (GrpcAgent instance) which in turn would callGrpcAgent::reset_command_stream(). Avoid this recursion by adding a newcancelling_for_destruction_member variable toCommandStreamwhich allows avoiding calling the observer if triggered by the destructor.Summary by CodeRabbit
Bug Fixes
Tests
✏️ Tip: You can customize this high-level summary in your review settings.