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

IpcReceiver hangs indefinitely on MacOS when other process ends #266

Open
sunjay opened this issue May 28, 2020 · 6 comments
Open

IpcReceiver hangs indefinitely on MacOS when other process ends #266

sunjay opened this issue May 28, 2020 · 6 comments

Comments

@sunjay
Copy link

sunjay commented May 28, 2020

I have some code that calls IpcReceiver::recv(). I expect that it will block and then eventually send IpcError::Disconnected once the other process ends, but I'm finding that on MacOS it just hangs the process and continues to wait forever.

Steps:

  1. call recv()
  2. allow the other process to end
  3. the recv() call will never return

One important detail is that I'm calling process::exit to end the process. That means that the drop code may not be run. I have tried manually dropping it with drop, but that has not fixed the problem.

This code works fine on other platforms.

@jdm
Copy link
Member

jdm commented May 28, 2020

Is this the same problem described by #201?

@jdm
Copy link
Member

jdm commented May 28, 2020

Mm, I guess that issue is referring to the accept() operation specifically, while this is just a standard IpcReceiver::recv.

@jdm
Copy link
Member

jdm commented May 28, 2020

I wonder if this is a symptom of #262?

@sunjay
Copy link
Author

sunjay commented May 28, 2020

Is this the same problem described by #201?

No, I don't think so. Like you said, this is just a standard IpcReceiver::recv.

I wonder if this is a symptom of #262?

It might be. I am creating the IpcOneShotServer on Process A and then waiting for an IpcSender from Process B. Process B is the one that ends and Process A is the one that hangs forever on the call to recv().

@gterzian
Copy link
Member

I've also noticed a similar behavior via the ROUTER, where it appeared like the route would never be removed, even when the last corresponding sender would have been dropped(the router removes the route when the receiver dis-connects).

@gterzian
Copy link
Member

gterzian commented Jun 16, 2020

I have tried manually dropping it with drop, but that has not fixed the problem.

Yes I can confirm.

The workaround is to send an explicit message signalling exit, as opposed to rely on the drop behavior(it's also a good way to isolate the problem further, since if sending the explicit message doesn't help, the problem might be somewhere in the business logic).

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

No branches or pull requests

3 participants