Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect PONG issued on subscriber channel #179

Closed
mgravell opened this issue Mar 28, 2024 · 0 comments · Fixed by #398
Closed

Incorrect PONG issued on subscriber channel #179

mgravell opened this issue Mar 28, 2024 · 0 comments · Fixed by #398
Assignees
Labels
bug Something isn't working

Comments

@mgravell
Copy link
Contributor

mgravell commented Mar 28, 2024

The PING command is one of only a few that are permitted once a connection has entered subscription mode; however, it has a different semantic:

If the client is subscribed to a channel or a pattern, it will instead return a multi-bulk with a "pong" in the first position and an empty bulk in the second position, unless an argument is provided in which case it returns a copy of the argument.

A typical reply might therefore be:

*2
$4
pong
$0

However, Garnet issues instead:

+PONG

To repro, try (looking in the obvious directory):

using StackExchange.Redis;
using StackExchange.Redis.Configuration;

var options = ConfigurationOptions.Parse("127.0.0.1:3278");
LoggingTunnel.LogToDirectory(options, @"c:\Code\RedisLog");
using var muxer = ConnectionMultiplexer.Connect(options);
var sub = muxer.GetSubscriber();
var ttl = sub.Ping();
Console.WriteLine(ttl);

This may impact clients that aren't expecting it; I think SE.Redis gracefully survives this, but I haven't checked for niche cases.

It may also be worth checking whether Garnet is responding to any other commands in subscriber mode; there are very few things it should allow while there are subscriptions assuming RESP2:

  • PING (with different behavior)
  • [P|S][UN]SUBSCRIBE
  • RESET
  • QUIT
@TalZaccai TalZaccai self-assigned this Mar 29, 2024
@darrenge darrenge added the bug Something isn't working label Mar 29, 2024
@badrishc badrishc assigned badrishc and unassigned TalZaccai May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants