Skip to content

Publish (still) does not work after a given data size if there are subscribers #790

@qcz

Description

@qcz

Describe the bug

I've reported a pub/sub related issue in #787. I've tested the fixed version and while the error message itself is fixed, publishing large messages (larger than 131 061 bytes) still don't work:

  • Garnet now properly accepts publishes larger than the size specified before. However subscribers won't get these messages. Tested with a minimal StackExchange.Redis subscriber and redis-cli, both does not work properly.
  • Furthermore after sending a large message, previous subscribers won't get any further messages regardless their size (even if they are 4 bytes, well below the supported range) and source (StackExhcange.Redis publisher and redis-cli raw command) until they reconnect to the server.

Steps to reproduce the bug

  1. Use the following configuration:
{
	"MemorySize": "4g",
	"PageSize": "128m",
	"PubSubPageSize": "128m",
	"IndexSize": "128m",
	"DisableObjects": true,
	"CompactionType" : "Lookup",
	"LogLevel": "Information",
}
  1. Subscribe using StackExchange.Redis or redis-cli:
var redis = ConnectionMultiplexer.Connect(ConfigurationOptions.Parse($"localhost:6379"));
redis.GetSubscriber().Subscribe(RedisChannel.Literal("test")).OnMessage((msg) =>
{
	byte[]? data = msg.Message;
	Console.WriteLine($"Received {data?.Length ?? 0} bytes");
});
  1. Use the following code to publish to redis:
var db = connectionMultiplexer.GetDatabase();
db.Publish(RedisChannel.Literal("test"), RandomNumberGenerator.GetBytes(1024)); // works
db.Publish(RedisChannel.Literal("test"), RandomNumberGenerator.GetBytes(127 * 1024)); // still works
db.Publish(RedisChannel.Literal("test"), RandomNumberGenerator.GetBytes(1024 * 1024)); // does not work
db.Publish(RedisChannel.Literal("test"), RandomNumberGenerator.GetBytes(1024)); // does not work, even if it is not larger than 131 061 bytes, because it was sent after a large message

Expected behavior

All pub/sub messages arrive which fits into PubSubPageSize and received by the subscriber.

Screenshots

No response

Release version

main branch (652b49f)

IDE

Visual Studio 2022

OS version

Windows 11 Pro

Additional context

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions