-
Notifications
You must be signed in to change notification settings - Fork 625
Fix Rust connection callback context cleanup and add regression test #5618
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: main
Are you sure you want to change the base?
Conversation
|
@microsoft-github-policy-service agree |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5618 +/- ##
=======================================
Coverage ? 85.28%
=======================================
Files ? 60
Lines ? 18663
Branches ? 0
=======================================
Hits ? 15917
Misses ? 2746
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
… None context case
src/rs/lib.rs
Outdated
| if !self.handle.is_null() { | ||
| // consume the context and drop it after handle close. | ||
| let ctx = unsafe { self.get_callback_ctx() }; | ||
| let ctx = unsafe { self.take_callback_ctx() }; |
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.
I think we have the same problem as above here.
ListenerClose could potentially trigger notifications (I don't think it currently does, but that might happen in the future). The context needs to stay set until ListenerClose returns.
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.
Thanks for the follow-up! I updated the close paths to keep the callback context alive until the Close call returns, so callbacks triggered synchronously during Close still see a valid context:
- Added peek_callback_ctx (read without clearing).
- Connection/Listener/Stream now use peek_callback_ctx in close_inner(), call Close, then drop the context after Close returns.
This aligns with the previous behavior you highlighted (context still present during Close) and prevents None when Close fires final notifications without a prior Shutdown.
Description
Closes: #5520
Testing
Testing
Documentation
Is there any documentation impact for this change?