Skip to content
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

IpcOneShotServer leaks mach ports #262

Closed
mitsuhiko opened this issue Feb 26, 2020 · 1 comment · Fixed by #327
Closed

IpcOneShotServer leaks mach ports #262

mitsuhiko opened this issue Feb 26, 2020 · 1 comment · Fixed by #327

Comments

@mitsuhiko
Copy link

mitsuhiko commented Feb 26, 2020

This is a minimal example of a system resource leak:

use ipc_channel::ipc::IpcOneShotServer;

fn main() {
    loop {
        let _ = IpcOneShotServer::<()>::new().unwrap();
    }
}
@mitsuhiko mitsuhiko changed the title Sending IpcSender through a IpcOneShotServer leaks mach ports IpcOneShotServer leaks mach ports Feb 26, 2020
@mitsuhiko
Copy link
Author

mitsuhiko commented Feb 26, 2020

From what I can tell the answer to this question is yes:

// FIXME(pcwalton): Does this leak?
let (right, acquired_right) = mach_port_extract_right(port, MACH_MSG_TYPE_MAKE_SEND as u32)?;
debug_assert!(acquired_right == MACH_MSG_TYPE_PORT_SEND as u32);

If I don't call that function I cannot observe a leak.

mrobinson added a commit that referenced this issue Sep 5, 2023
The code allocates a mach port and it needs to deallocate it when the
server is dropped.

Fixes #262.
mrobinson added a commit that referenced this issue Sep 5, 2023
The code allocates a mach port and it needs to deallocate it when the
server is dropped.

Fixes #262.
github-merge-queue bot pushed a commit that referenced this issue Sep 5, 2023
The code allocates a mach port and it needs to deallocate it when the
server is dropped.

Fixes #262.
@jdm jdm closed this as completed in #327 Sep 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant