Skip to content

cfn-hup in daemon mode doesn't work on any currently supported Python version, because of dependency on obsolete python-daemon version #392

@Aneurin

Description

@Aneurin

aws-cfn-bootstrap requires python-daemon<2.2, but version 2.2.4 (from 2019) is the oldest version that supports Python 3.8+. Thus, any OS with a current version of Python (eg 3.10 in Ubuntu 22.04) will get the following error when attempting to launch cfn-hup in daemon mode:

Traceback (most recent call last):
  File "/usr/local/bin/cfn-hup", line 226, in <module>
    with daemon.DaemonContext(pidfile=pidfile.TimeoutPIDLockFile('/var/run/cfn-hup.pid', 300),
  File "/usr/local/lib/python3.10/dist-packages/daemon/daemon.py", line 280, in __init__
    detach_process = is_detach_process_context_required()
  File "/usr/local/lib/python3.10/dist-packages/daemon/daemon.py", line 801, in is_detach_process_context_required
    if is_process_started_by_init() or is_process_started_by_superserver():
  File "/usr/local/lib/python3.10/dist-packages/daemon/daemon.py", line 778, in is_process_started_by_superserver
    if is_socket(stdin_fd):
  File "/usr/local/lib/python3.10/dist-packages/daemon/daemon.py", line 743, in is_socket
    file_socket = socket.fromfd(fd, socket.AF_INET, socket.SOCK_RAW)
  File "/usr/lib/python3.10/socket.py", line 546, in fromfd
    return socket(family, type, proto, nfd)
  File "/usr/lib/python3.10/socket.py", line 232, in __init__
    _socket.socket.__init__(self, family, type, proto, fileno)
OSError: [Errno 88] Socket operation on non-socket

Ignoring the dependency error and forcing a newer python-daemon version seems to lead to cfn-hup silently failing, which I've not investigated further, so currently the best workaround I know of is to run it with --no-daemon in a cronjob or systemd timer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugkeepDon't auto-close this

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions