dotnet / dotnet/orleans

Error getting generic grain when using a prefix

Open
#9,355 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
10.9k
Forks
2.1k
Avg merge
13h 56m
Merged PRs (30d)
351

Description

Given the following types:

```c#
interface IGenericGrain{}

class ConcreteGrain : IGenericGrain{}
```

this call will fail to find the grain:
```c#
GrainFactory.GetGrain>(myKey, "ConcreteGrain")
```

Omitting the prefix does work (if only one type)
```c#
GrainFactory.GetGrain>(myKey)
```

In 7.1.2 the first call worked successfully, but in 8.2 it no longer works. (I haven't tried any version in-between)

I debugged a bit and https://github.com/dotnet/orleans/blob/6905fa9b309446682aabd7265ce98d8825e0390d/src/Orleans.Core/Core/GrainInterfaceTypeToGrainTypeResolver.cs#L36 has a pretty different flow (in regards to a cache lookup failure) between the two calls.
The cache seems to only have an entry for `IGenericGrain` and not for `IGenericGrain`; however, the result of https://github.com/dotnet/orleans/blob/6905fa9b309446682aabd7265ce98d8825e0390d/src/Orleans.Core/Core/GrainInterfaceTypeToGrainTypeResolver.cs#L48 is the generic type which causes the cache lookup to fail.

Perhaps the lookup failing is fine and it should have something similar to the other flow, but I'm not familiar enough to say: https://github.com/dotnet/orleans/blob/6905fa9b309446682aabd7265ce98d8825e0390d/src/Orleans.Core/Core/GrainInterfaceTypeToGrainTypeResolver.cs#L139

Contributor guide

Open the contributing guide

Research direction

Start in src/Orleans.Core/Core/GrainInterfaceTypeToGrainTypeResolver.cs, especially the cache lookup flows around lines 36, 48, and 139. Compare prefixed and unprefixed generic grain resolution, then verify that the prefixed GetGrain call resolves the concrete grain as it did in version 7.1.2.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
distributed-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.