Skip to content

Implement CLIENT KILL MAXAGE <maxage>#12299

Merged
oranagra merged 5 commits intoredis:unstablefrom
slavak:kill_age
Jan 30, 2024
Merged

Implement CLIENT KILL MAXAGE <maxage>#12299
oranagra merged 5 commits intoredis:unstablefrom
slavak:kill_age

Conversation

@slavak
Copy link
Copy Markdown
Contributor

@slavak slavak commented Jun 11, 2023

Adds an ability to kill clients older than a specified age.

Also, fixed the age calculation in catClientInfoString to use commandTimeSnapshot
instead of the old server.unixtime, and added missing documentation for
CLIENT KILL ID to output of CLIENT help.

Adds an ability to kill clients older than a specified age.
Also, add missing documentation for `CLIENT KILL ID` to output
 of `CLIENT help`.
@slavak
Copy link
Copy Markdown
Contributor Author

slavak commented Jun 18, 2023

@oranagra Pushed a new commit with CR fixes:

  • Use commandTimeSnapshot instead of server.unixtime. (Also fixed in the existing code for returning client age, such as for CLIENT LIST.)
  • Used the suggested tag syntax for the unit test.
  • Tweaked the unit test to filter on user as an extra precaution.

I updated the top PR comment so it's correct when squash-merging.

@enjoy-binbin enjoy-binbin added state:needs-doc-pr requires a PR to redis-doc repository release-notes indication that this issue needs to be mentioned in the release notes labels Nov 16, 2023
@oranagra oranagra added the approval-needed Waiting for core team approval to be merged label Jan 30, 2024
@oranagra
Copy link
Copy Markdown
Member

@redis/core-team please approve

@oranagra
Copy link
Copy Markdown
Member

approved in core-team meeting with the above comment (AGE -> MAXAGE)

@oranagra oranagra changed the title Implement CLIENT KILL AGE <max-age> Implement CLIENT KILL MAXAGE <maxage> Jan 30, 2024
@oranagra oranagra merged commit 24f6d08 into redis:unstable Jan 30, 2024
@oranagra
Copy link
Copy Markdown
Member

@slavak finally merged.
wanna do the redis-doc PR?

@slavak slavak deleted the kill_age branch February 4, 2024 09:44
roggervalf pushed a commit to roggervalf/redis that referenced this pull request Feb 11, 2024
Adds an ability to kill clients older than a specified age.

Also, fixed the age calculation in `catClientInfoString` to use
`commandTimeSnapshot`
instead of the old `server.unixtime`, and added missing documentation
for
`CLIENT KILL ID` to output of `CLIENT help`.

---------

Co-authored-by: Oran Agra <[email protected]>
enjoy-binbin added a commit to enjoy-binbin/redis that referenced this pull request Feb 11, 2024
This test fails occasionally:
```
*** [err]: CLIENT KILL maxAGE will kill old clients in tests/unit/introspection.tcl
Expected 2 == 1 (context: type eval line 14 cmd {assert {$res == 1}} proc ::test)
```

This test is very likely to do a false positive if the execute time
takes longer than the max age, for example, if the execution time
between sleep and kill exceeds 1s, rd2 will also be killed due to
the max age.

The test can adjust the order of execution statements to increase
the probability of passing, but this is still will be a timing issue
in some slow machines, so decided give it a few more chances.

The test was introduced in redis#12299.
oranagra pushed a commit that referenced this pull request Feb 12, 2024
This test fails occasionally:
```
*** [err]: CLIENT KILL maxAGE will kill old clients in tests/unit/introspection.tcl
Expected 2 == 1 (context: type eval line 14 cmd {assert {$res == 1}} proc ::test)
```

This test is very likely to do a false positive if the execute time
takes longer than the max age, for example, if the execution time
between sleep and kill exceeds 1s, rd2 will also be killed due to
the max age.

The test can adjust the order of execution statements to increase
the probability of passing, but this is still will be a timing issue
in some slow machines, so decided give it a few more chances.

The test was introduced in #12299.
funny-dog pushed a commit to funny-dog/redis that referenced this pull request Sep 17, 2025
Adds an ability to kill clients older than a specified age.

Also, fixed the age calculation in `catClientInfoString` to use
`commandTimeSnapshot`
instead of the old `server.unixtime`, and added missing documentation
for
`CLIENT KILL ID` to output of `CLIENT help`.

---------

Co-authored-by: Oran Agra <[email protected]>
funny-dog pushed a commit to funny-dog/redis that referenced this pull request Sep 17, 2025
This test fails occasionally:
```
*** [err]: CLIENT KILL maxAGE will kill old clients in tests/unit/introspection.tcl
Expected 2 == 1 (context: type eval line 14 cmd {assert {$res == 1}} proc ::test)
```

This test is very likely to do a false positive if the execute time
takes longer than the max age, for example, if the execution time
between sleep and kill exceeds 1s, rd2 will also be killed due to
the max age.

The test can adjust the order of execution statements to increase
the probability of passing, but this is still will be a timing issue
in some slow machines, so decided give it a few more chances.

The test was introduced in redis#12299.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approval-needed Waiting for core team approval to be merged release-notes indication that this issue needs to be mentioned in the release notes state:needs-doc-pr requires a PR to redis-doc repository

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants