garnet
garnet copied to clipboard
Incorrect PONG issued on subscriber channel
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