Skip to content

Adding a server flag for idle connection closure #5842

@Niennienzz

Description

@Niennienzz

Did you search GitHub Issues and GitHub Discussions First?

  • Yes.

Is your feature request related to a problem? Please describe.

  • It would be nice to automatically kill long-running idle clients.
  • Users seeing some clients idle for hours and just wanting to kill them off automatically.
  • Note that this is different from --tcp_keepalive.

Describe the solution you'd like.

  • Adding a server flag to control this behavior. For example, Redis has the timeout config:
# Close the connection after a client is idle for N seconds (0 to disable)
timeout 0

Describe alternatives you've considered

  • The --tcp_keepalive flag can be used, but it detects dead peers, instead of killing idle connections.
  • That's probably why Redis supports both flags.
# If non-zero, use SO_KEEPALIVE to send TCP ACKs to clients in absence
# of communication. This is useful for two reasons:
#
# 1) Detect dead peers.
# 2) Force network equipment in the middle to consider the connection to be
#    alive.
#
# On Linux, the specified value (in seconds) is the period used to send ACKs.
# Note that to close the connection the double of the time is needed.
# On other kernels the period depends on the kernel configuration.
tcp-keepalive 300

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