Skip to content
This repository has been archived by the owner on Apr 18, 2018. It is now read-only.

sockets should be set close on exec #9

Open
rogerbinns opened this issue Feb 4, 2011 · 2 comments
Open

sockets should be set close on exec #9

rogerbinns opened this issue Feb 4, 2011 · 2 comments

Comments

@rogerbinns
Copy link

The sockets this library makes are not marked close on exec and consequently are inherited by any child processes such as those executed by the subprocess module.

Code is:

    fd = sock.fileno()
    old_flags = fcntl.fcntl(fd, fcntl.F_GETFD)
    fcntl.fcntl(fd, fcntl.F_SETFD, old_flags | fcntl.FD_CLOEXEC)
@mtai
Copy link

mtai commented Feb 9, 2011

Added and will be part of the next release

@agronick
Copy link

This is still open? I have to shutdown my connections like this to stop them from staying in use:

        for conn in gm_client.connection_list:
            try:
                conn.gearman_socket.shutdown(socket.SHUT_RDWR)
                conn.gearman_socket.close()
                conn._reset_connection()
            except:
                pass

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants