Skip to content

Cache key generation algorithm causes collisions #100

@andrey-prokopyev

Description

@andrey-prokopyev

Cache key is constructed from GetHashCode() of message. With intensive cache usage when several message types are cached we get exceptions when cache keys of different types coincide.

System.AggregateException: One or more errors occurred. ---> System.InvalidCastException: Unable to cast object of type 'ResponseType1' to type 'ResponseType2'.
at Contour.Sending.AbstractSender.<>c__18`1.<Request>b__18_0(Task`1 t) in C:\dev\source\git\Contour\Sources\Contour\Sending\AbstractSender.cs:line 204
at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
at System.Threading.Tasks.Task.Execute()

Bug was introduced in 042250d. Improved caching in "silver-lizard" has less probability of key collisions because of using SHA256 as key generator, so it would be nice to merge caching from silver-lizard.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions