RE: rsockets and fork

Hefty, Sean
2012-08-23T01:32:21Z

> I saw this code in preload library and was wondering why rsocket() is called
> and closed immediately if fork_support is enabled. I guess you are doing this
> so that you can fallback to real socket at the initial socket() call instead
> of waiting all the way until fork_active/fork_passive. This should be OK
> specifically if a user is using preload library and enabling fork_support.

The initial call to rsocket() is made to see if that socket type is enabled. This way I don't need to update both rsocket and the preload library when new socket types are supported. So, yes, it allows us to fallback to a normal socket quickly if rsockets does not support the requested type.

> This doesn't look like a hack to me. However it looks like a bug if rsocket()
> followed by rclose() doesn't cleanup all the resources correctly.

I can come up with something a little cleaner, which I think would work okay. I'm just wondering if this isn't really an issue with libmlx4 supporting fork(). I just need some way to confirm that this is the cause of the hangs.

Regardless, I'll try to push in a patch by the end of the week with this fix.

Thanks for your help!

- Sean