Skip to content

Periodically update timestamp of socket file so socket won't be deleted when sweeping temporary files #1710

Open

Description

@stevecj

Many systems periodically sweep temporary files, deleting any that have not been accessed in a long time. Socket file timestamps are not updated when data is passed through them, so even if they are actively in use, they will appear stale to the sweeper unless they have been explicitly "touched".

This has caused a problem for the product that I work on, and it was very hard to debug. We ended up with multiple instances of supervisord after shutting down and restarting our application and couldn't figure out why that happened.

It is obviously possible for me to solve this by adding a process managed by Supervisor that periodically touches the socket file, but it would be nice if supervisord would just do that automatically. I see that PostgreSQL's socket file timestamp gets updated once every half an hour, so that seems like a good interval size.

Activity

  1. stevecj commented on Feb 24, 2026

    @stevecj
    Author

    Additionally (belt and suspenders) maybe check that the socket still exists at its supposed path and drop/recreate the socket if that has happened.

  2. mnaberez commented on Feb 24, 2026

    @mnaberez
    Member

    The manual has a specific warning not to use /tmp for the socket file:

    .. warning::
    The example configuration output by :program:`echo_supervisord_conf` uses
    ``/tmp/supervisor.sock`` as the socket file. That path is an example only
    and will likely need to be changed to a location more appropriate for your
    system. Some systems periodically delete older files in ``/tmp``. If the
    socket file is deleted, :program:`supervisorctl` will be unable to
    connect to :program:`supervisord`.

    Could this warning be improved?

  3. stevecj commented on Feb 25, 2026

    @stevecj
    Author

    Thanks for pointing that out. I had not seen that in the manual.

    The reason this came up for me is that we were having a problem keeping sockets in the application's data directory because some customers want to install that in a path that is too long for a socket file path. I moved that to the temporary directory because that path is always short, and I was following the example of PostgreSQL which keeps its socket under /tmp/ without a problem since it periodically updates the socket file's timestamp.

    Earlier today, I learned from a coworker that a more standard place to put those is within /run/ .

    The main improvement your warning needs is for users like me to read it. 😁 That said, it might be good to mention that /run/user/<uid>/ might be a good place to put the socket file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions