ipc-channel icon indicating copy to clipboard operation
ipc-channel copied to clipboard

Panic post upgrading from rustc 1.66 to later versions on MacOS

Open mohitreddy1996 opened this issue 2 years ago • 1 comments

Error - thread 'main' panicked at 'assertion failed: self.port == MACH_PORT_NULL', /Users/mohitreddy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ipc-channel-0.17.0/src/platform/macos/mod.rs:602:9

Saw the above errors with the following versions of rustc -

rustc -V
rustc 1.68.2 (9eb3afe9e 2023-03-27)

rustc -V
rustc 1.70.0 (90c541806 2023-05-31)

rustc -V
rustc 1.72.0 (5680fa18f 2023-08-23)

Sample code (happy to provide more detailed code if required, but IMO the setup looks correct. We have been running the same code for sometime now on local machines).

Code which setups the OneShot server and is the main process -

    let (server, sname) = IpcOneShotServer::new().unwrap();
    let (_, x): (_, IpcReceiver<T>) = server.accept().unwrap();
    
    // we keep x around and use it to receive data on it

Code with the producer of the channel. This is run as child process -

    let tx0 = IpcSender::connect(server_name)?;
    let (tx1, rx1): (
        IpcSender<T>,
        IpcReceiver<T>,
    ) = ipc_channel::ipc::channel().unwrap();
    tx0.send(rx1).unwrap();

    // we keep tx1 around

Versions which seem to work ipc-channel crate 1.16.0 and rustc 1.66.0. NOTE: ipc-channel 1.17.0 fails with the same error on rustc 1.66.0.

mohitreddy1996 avatar Sep 24 '23 03:09 mohitreddy1996

I tried building HEAD with Rust 1.70.0 and got:

error: package `clap v4.5.28` cannot be built because it requires rustc 1.74 or newer, while the currently active rustc version is 1.70.0

I then upgraded Rust to 1.74.1 and cargo test was clean. I wrote a test to try to reproduce this issue, but the test passed. Similarly, the test passes with the latest stable Rust 1.84.1.

This was all on macOS Sonoma 14.7.2.

@mohitreddy1996: please could you try to reproduce the issue at HEAD and report back.

glyn avatar Feb 04 '25 10:02 glyn