On Windows 0MQ sockets handles are inherited by child processes

Description

On Windows 0MQ sockets created by an application are inherited by child processes that then keep them open.

If the application dies for some reason it cannot be restarted since the ports result as already bound.

On Linux this behaviour is prevented using O_CLOEXEC flag on the socket handle.

The way to do it in Windows would be to use the SetHandleInformation (http://msdn.microsoft.com/en-us/library/windows/desktop/ms724935(v=vs.85).aspx) on the sockets handles,

SetHandleInformation(socketHandle, HANDLE_FLAG_INHERIT, 0);

I hope this will be considered something to be fixed in the libzmq for Windows platforms.

Thanks for your support.

See pull request: https://github.com/zeromq/zeromq2-x/pull/51

Environment

All Windows platforms

Activity

Show:

PieterP May 9, 2012 at 7:54 PM

Fixed on 2.x and 3.x, closing.

Maurizio Melato May 7, 2012 at 3:07 PM

Pull request for the libzmq trunk: https://github.com/zeromq/libzmq/pull/336

Fixed

Details

Assignee

Reporter

Labels

Components

Fix versions

Affects versions

Priority

Created May 4, 2012 at 2:11 PM
Updated May 9, 2012 at 7:54 PM
Resolved May 9, 2012 at 7:54 PM