-
Notifications
You must be signed in to change notification settings - Fork 620
Description
Describe the bug
The Rust bindings make a distinction between owned and ref types, for instance, Connection and ConnectionRef. On the server side, a listener callback receives a ConnectionRef for the NewConnection event. However, the callback handler attached to a ConnectionRef is not automatically cleaned up internally.
Affected OS
- Windows
- Linux
- macOS
- Other (specify below)
Additional OS information
No response
MsQuic version
main
Steps taken to reproduce bug
- Modify the example to allocate a large
Box<[u8; N]>inside the connection handler closure - Watch the memory usage grow for each new connection
Expected behavior
Setting connection_ref.set_callback_handler(handler) should automatically destroy the handler, if present. For every ConnectionRef, I assume someone owns a Connection internally. This conn: Connection should ideally invoke the cleanup.
Actual outcome
The handler leaks. The example below provides a way to handle this, but I am not sure if this is the idiomatic way to clean up resources.
msquic/src/rs/server_client_test.rs
Line 162 in f7657ad
| unsafe { Connection::from_raw(conn.as_raw()) }; |
Additional details
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Status