Skip to content

Missing automatic removal of listener unix socket (uds) #4747

Description

@achimnol

Describe the bug

There seems to be no explicit removal of the listener UNIX socket during Glide runtime drop or language-specific client cleanup (at least Python and NodeJS).

The listener implementation in the Rust core has two places to remove the socket file:

  • close_socket() method
  • after breaking out the accept() loop due to an syscall error

But there are no other places calling close_socket() method except test codes.

So I wonder if the current implementation relies on automatic cleanup of tmpfs upon reboots or periodic cleanup. If so, this design is prone to potential memory/inode leaks in long-running servers as the socket files are accumulated whenever processes using valkey-glide are created. Relying on it is also prone to unintended removal of socket files.

Expected Behavior

The listener unix socket should be cleaned up when the user process terminates.

Current Behavior

It does not.

Reproduction Steps

Just repeat spwaning Python/NodeJS processes using valkey-glide and check /tmp.

Possible Solution

  • Add deliberate, explicit removal of UDS when the user process is terminated. It is required to prevent memory/inode leaks for long-running server instances where processes using valkey-glide are frequently spawned. Otherwise, users need to rely on automatic tmpfs cleanup services.
  • If so, we need to fix the following:
    • Make UDS location user-configurable. Currently it's hard-coded as /tmp.
    • Add an warning in the documentation about potential unintended removal of UDS under /tmp for long-running server processes in the presence of automatic tmpfs cleanup services.
    • Periodically refresh mtime of UDS under /tmp, but this would not be a perfect solution depending on tmpfs cleanup configuration.

Additional Information/Context

Client version used

2.0.1

Engine type and version

Redis 6.2

OS

Ubuntu 24.04

Language

Python

Language Version

3.13

Cluster information

No response

Logs

No response

Other information

No response

Activity

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

    Feature ✨Additional feature, big or smallUser issue 🚨Issue opened by a userUsers PainAn issue known to cause users pain, generaly open by the user.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions