#32 unix socket cleanup

Daniel Black

It seems as the the unix socket needs to be cleaned up manually during debugging and unforseen dkim-filter terminations.

Can the signal handler or exit routine remove the unix socket (if used)?


  • Logged In: YES
    Originator: NO

    The signal handler in libmilter, which covers HUP, INT and TERM signals, does arrange to shut down and clean up the socket during normal terminations. In addition the parent process (when AutoRestart is enabled) will attempt to delete the socket if there appears to be nothing listening on it before restarting the child.

    It's not really possible to have the filter delete its socket on abnormal terminations, especially SIGKILL. If the process has become unstable due to memory corruption or any of a number of other causes, the process will be terminated by the kernel without a safe opportunity to clean up the socket.

    Instead, the filter could check to see if the socket is "live" before starting. This is a simple matter of recycling the AutoRestart socket check for the general case.

    I'll attach a patch that does so, though I haven't really tested it yet.

    • milestone: --> v2.4.4
    • assigned_to: nobody --> sm-msk
  • Proposed patch #1

  • Logged In: YES
    Originator: NO

    Try the attached patch. It's against the 2.5.0 Betas but
    you should be able to massage it into the 2.4.4 code
    easily enough. If not, let me know and I'll try to
    do a back-port.

    File Added: PATCH

  • Logged In: YES
    Originator: NO

    Patch included in 2.5.0, now released.

    • status: open --> closed-accepted