Skip to content

valkey-cli auto-exit from subscribed mode#1432

Merged
zuiderkwast merged 20 commits into
valkey-io:unstablefrom
Nikhil-Manglore:subscribe-mode-bug
Jan 8, 2025
Merged

valkey-cli auto-exit from subscribed mode#1432
zuiderkwast merged 20 commits into
valkey-io:unstablefrom
Nikhil-Manglore:subscribe-mode-bug

Conversation

@Nikhil-Manglore

@Nikhil-Manglore Nikhil-Manglore commented Dec 12, 2024

Copy link
Copy Markdown
Member

Resolves issue with valkey-cli not auto exiting from subscribed mode on reaching zero pub/sub subscription (previously filed on Redis) redis/redis#12592

Signed-off-by: Nikhil Manglore <nmanglor@amazon.com>
@codecov

codecov Bot commented Dec 12, 2024

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 96.29630% with 1 line in your changes missing coverage. Please review.

Project coverage is 70.89%. Comparing base (b3b4bdc) to head (fe091cf).
Report is 7 commits behind head on unstable.

Files with missing lines Patch % Lines
src/valkey-cli.c 96.29% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #1432      +/-   ##
============================================
+ Coverage     70.83%   70.89%   +0.05%     
============================================
  Files           120      120              
  Lines         64911    64980      +69     
============================================
+ Hits          45982    46069      +87     
+ Misses        18929    18911      -18     
Files with missing lines Coverage Δ
src/valkey-cli.c 55.85% <96.29%> (+0.36%) ⬆️

... and 50 files with indirect coverage changes

@zuiderkwast zuiderkwast left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello! Welcome to Valkey!

I remember this issue. :)

Comment thread src/valkey-cli.c Outdated
Comment thread src/valkey-cli.c Outdated
Signed-off-by: Nikhil Manglore <nmanglor@amazon.com>

@zuiderkwast zuiderkwast left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logic looks correct, but I have two comments.

I think it would be good to add a test for valkey-cli that uses SUBSCRIBE, PSUBSCRIBE, SSUBSCRIBE in the same session, an exits pubsub mode when all three are unsubscribed.

Comment thread src/valkey-cli.c Outdated
Comment thread tests/unit/pubsub.tcl Outdated
Signed-off-by: Nikhil Manglore <nmanglor@amazon.com>
Signed-off-by: Nikhil Manglore <nmanglor@amazon.com>

@zuiderkwast zuiderkwast left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good, thanks. I have some new comments. :)

Comment thread src/valkey-cli.c Outdated
Comment thread tests/integration/valkey-cli.tcl Outdated
Comment thread tests/integration/valkey-cli.tcl Outdated
Signed-off-by: Nikhil Manglore <nmanglor@amazon.com>

@zuiderkwast zuiderkwast left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's getting better! I'm not sure if check for "(subscribed mode)" in the prompt works as intended though.

Maybe we need to test this in some other way. If you can't solve it, then I'll try to think of something.

Comment thread src/valkey-cli.c Outdated
Comment thread tests/integration/valkey-cli.tcl Outdated
Comment thread src/valkey-cli.c Outdated
Comment thread src/valkey-cli.c Outdated
Comment thread tests/integration/valkey-cli.tcl
Comment thread src/valkey-cli.c Outdated
…s more robust

Signed-off-by: Nikhil Manglore <nmanglor@amazon.com>
Signed-off-by: Nikhil Manglore <nmanglor@amazon.com>
Comment thread src/valkey-cli.c Outdated
Signed-off-by: Nikhil Manglore <nmanglor@amazon.com>
Comment thread src/valkey-cli.c Outdated
Signed-off-by: Nikhil Manglore <nmanglor@amazon.com>
Signed-off-by: Nikhil Manglore <nmanglor@amazon.com>
Signed-off-by: Nikhil Manglore <nmanglor@amazon.com>
Comment thread src/valkey-cli.c Outdated

@hpatro hpatro left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall. minor nitpicks.

Comment thread src/valkey-cli.c Outdated
Comment thread src/valkey-cli.c Outdated
Comment thread src/valkey-cli.c Outdated
Comment thread src/valkey-cli.c Outdated
Signed-off-by: Nikhil Manglore <nmanglor@amazon.com>
@zuiderkwast

Copy link
Copy Markdown
Contributor

The clang-format CI job is complaining about trailing whitespace. See https://github.com/valkey-io/valkey/actions/runs/12676568798/job/35330205216?pr=1432

To fix it, you can run clang-format -i src/valkey-cli.c or just manually read the diff suggested by clang-format CI job.

Signed-off-by: Nikhil Manglore <nmanglor@amazon.com>
Signed-off-by: Nikhil Manglore <nmanglor@amazon.com>
@Nikhil-Manglore

Nikhil-Manglore commented Jan 8, 2025

Copy link
Copy Markdown
Member Author

I just realized one of the external tests seems to fail here in the checks but always passes locally. Do you know why this could be occurring?

@zuiderkwast zuiderkwast left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your patience!

@zuiderkwast

Copy link
Copy Markdown
Contributor

I just realized one of the external tests seems to fail here in the checks but always passes locally. Do you know why this could be occurring?

I don't know. I think some github runners are slow or there are some other problems. The failures are not related to this PR.

@zuiderkwast zuiderkwast changed the title valkey-cli doesn't auto exit from subscribed mode on reaching zero subscription valkey-cli auto exit from subscribed mode on reaching zero subscriptions Jan 8, 2025
@zuiderkwast zuiderkwast changed the title valkey-cli auto exit from subscribed mode on reaching zero subscriptions valkey-cli auto-exit from subscribed mode Jan 8, 2025
@zuiderkwast zuiderkwast merged commit 9e02049 into valkey-io:unstable Jan 8, 2025
@hpatro

hpatro commented Jan 8, 2025

Copy link
Copy Markdown
Contributor

Thanks @Nikhil-Manglore for working on this!

@Nikhil-Manglore Nikhil-Manglore deleted the subscribe-mode-bug branch January 8, 2025 22:17
@Nikhil-Manglore Nikhil-Manglore restored the subscribe-mode-bug branch January 8, 2025 23:08
@Nikhil-Manglore Nikhil-Manglore deleted the subscribe-mode-bug branch January 8, 2025 23:13
enjoy-binbin pushed a commit that referenced this pull request Jan 12, 2025
The commands used in valkey-cli tests are not important the reply schema
validation. Skip them to avoid the problem if tests hanging. This has
failed lately in the daily job:

```
[TIMEOUT]: clients state report follows.
sock55fedcc19be0 => (IN PROGRESS) valkey-cli pubsub mode with single standard channel subscription
Killing still running Valkey server 33357
```

These test cases use a special valkey-cli command `:get pubsub` command,
which is an internal command to valkey-cli rather than a Valkey server
command. This command hangs when compiled with with logreqres enabled.
Easy solution is to skip the tests in this setup.

The test cases were introduced in #1432.

Signed-off-by: Viktor Söderqvist <viktor.soderqvist@est.tech>
proost pushed a commit to proost/valkey that referenced this pull request Jan 17, 2025
Resolves issue with valkey-cli not auto exiting from subscribed mode on
reaching zero pub/sub subscription (previously filed on Redis)
redis/redis#12592

---------

Signed-off-by: Nikhil Manglore <nmanglor@amazon.com>
Signed-off-by: proost <jwalag87@gmail.com>
proost pushed a commit to proost/valkey that referenced this pull request Jan 17, 2025
The commands used in valkey-cli tests are not important the reply schema
validation. Skip them to avoid the problem if tests hanging. This has
failed lately in the daily job:

```
[TIMEOUT]: clients state report follows.
sock55fedcc19be0 => (IN PROGRESS) valkey-cli pubsub mode with single standard channel subscription
Killing still running Valkey server 33357
```

These test cases use a special valkey-cli command `:get pubsub` command,
which is an internal command to valkey-cli rather than a Valkey server
command. This command hangs when compiled with with logreqres enabled.
Easy solution is to skip the tests in this setup.

The test cases were introduced in valkey-io#1432.

Signed-off-by: Viktor Söderqvist <viktor.soderqvist@est.tech>
Signed-off-by: proost <jwalag87@gmail.com>
kronwerk pushed a commit to kronwerk/valkey that referenced this pull request Jan 27, 2025
Resolves issue with valkey-cli not auto exiting from subscribed mode on
reaching zero pub/sub subscription (previously filed on Redis)
redis/redis#12592

---------

Signed-off-by: Nikhil Manglore <nmanglor@amazon.com>
kronwerk pushed a commit to kronwerk/valkey that referenced this pull request Jan 27, 2025
The commands used in valkey-cli tests are not important the reply schema
validation. Skip them to avoid the problem if tests hanging. This has
failed lately in the daily job:

```
[TIMEOUT]: clients state report follows.
sock55fedcc19be0 => (IN PROGRESS) valkey-cli pubsub mode with single standard channel subscription
Killing still running Valkey server 33357
```

These test cases use a special valkey-cli command `:get pubsub` command,
which is an internal command to valkey-cli rather than a Valkey server
command. This command hangs when compiled with with logreqres enabled.
Easy solution is to skip the tests in this setup.

The test cases were introduced in valkey-io#1432.

Signed-off-by: Viktor Söderqvist <viktor.soderqvist@est.tech>
vitarb pushed a commit to vitarb/valkey that referenced this pull request Jun 24, 2025
The commands used in valkey-cli tests are not important the reply schema
validation. Skip them to avoid the problem if tests hanging. This has
failed lately in the daily job:

```
[TIMEOUT]: clients state report follows.
sock55fedcc19be0 => (IN PROGRESS) valkey-cli pubsub mode with single standard channel subscription
Killing still running Valkey server 33357
```

These test cases use a special valkey-cli command `:get pubsub` command,
which is an internal command to valkey-cli rather than a Valkey server
command. This command hangs when compiled with with logreqres enabled.
Easy solution is to skip the tests in this setup.

The test cases were introduced in valkey-io#1432.

Signed-off-by: Viktor Söderqvist <viktor.soderqvist@est.tech>
vitarb pushed a commit to vitarb/valkey that referenced this pull request Jun 24, 2025
The commands used in valkey-cli tests are not important the reply schema
validation. Skip them to avoid the problem if tests hanging. This has
failed lately in the daily job:

```
[TIMEOUT]: clients state report follows.
sock55fedcc19be0 => (IN PROGRESS) valkey-cli pubsub mode with single standard channel subscription
Killing still running Valkey server 33357
```

These test cases use a special valkey-cli command `:get pubsub` command,
which is an internal command to valkey-cli rather than a Valkey server
command. This command hangs when compiled with with logreqres enabled.
Easy solution is to skip the tests in this setup.

The test cases were introduced in valkey-io#1432.

Signed-off-by: Viktor Söderqvist <viktor.soderqvist@est.tech>
zuiderkwast added a commit to vitarb/valkey that referenced this pull request Aug 15, 2025
The commands used in valkey-cli tests are not important the reply schema
validation. Skip them to avoid the problem if tests hanging. This has
failed lately in the daily job:

```
[TIMEOUT]: clients state report follows.
sock55fedcc19be0 => (IN PROGRESS) valkey-cli pubsub mode with single standard channel subscription
Killing still running Valkey server 33357
```

These test cases use a special valkey-cli command `:get pubsub` command,
which is an internal command to valkey-cli rather than a Valkey server
command. This command hangs when compiled with with logreqres enabled.
Easy solution is to skip the tests in this setup.

The test cases were introduced in valkey-io#1432.

Signed-off-by: Viktor Söderqvist <viktor.soderqvist@est.tech>
zuiderkwast added a commit to vitarb/valkey that referenced this pull request Aug 15, 2025
The commands used in valkey-cli tests are not important the reply schema
validation. Skip them to avoid the problem if tests hanging. This has
failed lately in the daily job:

```
[TIMEOUT]: clients state report follows.
sock55fedcc19be0 => (IN PROGRESS) valkey-cli pubsub mode with single standard channel subscription
Killing still running Valkey server 33357
```

These test cases use a special valkey-cli command `:get pubsub` command,
which is an internal command to valkey-cli rather than a Valkey server
command. This command hangs when compiled with with logreqres enabled.
Easy solution is to skip the tests in this setup.

The test cases were introduced in valkey-io#1432.

Signed-off-by: Viktor Söderqvist <viktor.soderqvist@est.tech>
zuiderkwast added a commit to vitarb/valkey that referenced this pull request Aug 21, 2025
The commands used in valkey-cli tests are not important the reply schema
validation. Skip them to avoid the problem if tests hanging. This has
failed lately in the daily job:

```
[TIMEOUT]: clients state report follows.
sock55fedcc19be0 => (IN PROGRESS) valkey-cli pubsub mode with single standard channel subscription
Killing still running Valkey server 33357
```

These test cases use a special valkey-cli command `:get pubsub` command,
which is an internal command to valkey-cli rather than a Valkey server
command. This command hangs when compiled with with logreqres enabled.
Easy solution is to skip the tests in this setup.

The test cases were introduced in valkey-io#1432.

Signed-off-by: Viktor Söderqvist <viktor.soderqvist@est.tech>
zuiderkwast added a commit that referenced this pull request Aug 22, 2025
The commands used in valkey-cli tests are not important the reply schema
validation. Skip them to avoid the problem if tests hanging. This has
failed lately in the daily job:

```
[TIMEOUT]: clients state report follows.
sock55fedcc19be0 => (IN PROGRESS) valkey-cli pubsub mode with single standard channel subscription
Killing still running Valkey server 33357
```

These test cases use a special valkey-cli command `:get pubsub` command,
which is an internal command to valkey-cli rather than a Valkey server
command. This command hangs when compiled with with logreqres enabled.
Easy solution is to skip the tests in this setup.

The test cases were introduced in #1432.

Signed-off-by: Viktor Söderqvist <viktor.soderqvist@est.tech>
sarthakaggarwal97 pushed a commit to sarthakaggarwal97/valkey that referenced this pull request Sep 16, 2025
The commands used in valkey-cli tests are not important the reply schema
validation. Skip them to avoid the problem if tests hanging. This has
failed lately in the daily job:

```
[TIMEOUT]: clients state report follows.
sock55fedcc19be0 => (IN PROGRESS) valkey-cli pubsub mode with single standard channel subscription
Killing still running Valkey server 33357
```

These test cases use a special valkey-cli command `:get pubsub` command,
which is an internal command to valkey-cli rather than a Valkey server
command. This command hangs when compiled with with logreqres enabled.
Easy solution is to skip the tests in this setup.

The test cases were introduced in valkey-io#1432.

Signed-off-by: Viktor Söderqvist <viktor.soderqvist@est.tech>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants