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

One-shot server hangs indefinetely if client process died

Open mkpankov opened this issue 7 years ago • 4 comments

Code looks like this:

                    let (server, server_name) = IpcOneShotServer::new().unwrap();

                    let mut child = Command::new(ciri_path)
                        .arg("--log")
                        .arg(ciri_logging_level)
                        .arg("--server")
                        .arg(server_name)
                        .arg("discover")
                        .arg(entry.path())
                        .env("CIRI_FIXTURE_DIR", ciri_fixture_dir)
                        .env("RUST_BACKTRACE", "1")
                        .spawn()
                        .unwrap();

                    let (_, (suite_name, test_name)): (_, (String, String)) =
                        server.accept().unwrap();

                    child.wait().unwrap();

My child panics in the main thread and dies w/o sending anything. This code then hangs on server.accept().

Is it expected? Should I take care of it on my side?

mkpankov avatar Jun 13 '18 12:06 mkpankov

Given that ipc-channel has no timeouts for receiving, this looks like expected behaviour.

jdm avatar Jun 13 '18 13:06 jdm

@jdm: Do we want to add this feature?

akoserwal avatar Jun 22 '18 07:06 akoserwal

If there's a way to prevent it, I would be open to accepting a pull request.

jdm avatar Jun 22 '18 13:06 jdm