Skip to content

UNIX communication sockets left in filesystem after receiving a signal #146

@rkrell

Description

@rkrell

I'm running Bjoern embedded in Python in this way:

logger.info('Bjoern bound to UNIX socket %s', sock_name)
try:
    os.unlink(sock_name)
except OSError:
    logger.error('Could not remove previous UNIX socket %s', sock_name)
    pass
bjoern.run(api_app, 'unix:{}'.format(sock_name))
try:
    os.unlink(sock_name)
except OSError:
    pass

By default, supervisord sends SIGTERM to processes to quit them, as stated in this issue.
Sending this signal, if I wouldn't remove the pending sockets, they prevent bjoern from starting next time, because the old socket is assumed to be in use.
I saw there is code for unlinking sockets in bjoern, but it is appearantly bypassed when receiving SIGTERM. Is there any way to make shutdown of bjoern more safe?

OS: Debian 8, Python 2.7.9

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions