Skip to content

[BUG] Suspicious Duplicated and Commented CodeΒ #423

@pil0t

Description

@pil0t

Describe the bug

After upgrading to the recent version of FusionCache and starting to use the Tags feature, we encountered issues under
load. One key symptom is a FusionCacheDistributedCacheException (with an inner TaskCanceledException) when accessing
Redis. We also see strange Redis timeouts happening within the .NET portion of our application.

Upon investigating the source code, we noticed suspicious code fragments in both the synchronous and asynchronous
implementations of the RedisBackplane subscription logic, where it looks like a block of commented-out code was
possibly left by mistake (see links and code snippets in Additional context).

To Reproduce

Unfortunately, we cannot provide a fully isolated Minimal Reproducible Example (MRE) at this time. However, the errors
typically arise under heavier loads after upgrading to the recent version of FusionCache that supports the Tags feature.

Expected behavior

We expect that:

  • No FusionCacheDistributedCacheException errors occur under normal or heavy load.
  • The Redis connection timeout issues are minimized or resolved.

Versions

We've encountered this issue on:

  • FusionCache version: 2.1.0
  • .NET version: 8.0
  • OS version: Docker in AWS ECS

Screenshots

No relevant screenshots are available.

Additional context

Here are the suspicious sections of code in the RedisBackplane implementations:

Both files show the same pattern:

if (_subscriber is null)
    throw new NullReferenceException("The backplane subscriber is null");

_subscriber.Subscribe(_channel, (_, v) =>
{
    var message = GetMessageFromRedisValue(v, _logger, _subscriptionOptions);

    if (message is null)
        return;

    OnMessage(message);
});

//_subscriber.SubscribeAsync(_channel, (_, v) =>
//{
//    var message = GetMessageFromRedisValue(v, _logger, _subscriptionOptions);
//
//    if (message is null)
//        return;
//
//    OnMessage(message);
//});

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions