StackExchange / StackExchange.Redis

General purpose redis client
https://stackexchange.github.io/StackExchange.Redis/
Other
5.84k stars 1.5k forks source link

Cannot convert to RedisValue: `MultiBulk` #2694

Closed WeihanLi closed 3 weeks ago

WeihanLi commented 2 months ago

exception stack trace:

System.InvalidCastException: Cannot convert to RedisValue: MultiBulk at StackExchange.Redis.RawResult.AsRedisValue() in //src/StackExchange.Redis/RawResult.cs:line 173 at StackExchange.Redis.ResultProcessor.StreamProcessorBase`1.ParseStreamEntryValues(RawResult& result) in //src/StackExchange.Redis/ResultProcessor.cs:line 2025 at StackExchange.Redis.ResultProcessor.StreamProcessorBase1.ParseRedisStreamEntry(RawResult& item) in /_/src/StackExchange.Redis/ResultProcessor.cs:line 1968 at Pipelines.Sockets.Unofficial.Arenas.SequenceExtensions.TryCopyTo[TFrom,TState,TTo](Sequence1& source, Span1 destination, Projection3 projection, TState& state) in //src/Pipelines.Sockets.Unofficial/Arenas/SequenceExtensions.cs:line 324 at Pipelines.Sockets.Unofficial.Arenas.SequenceExtensions.CopyTo[TFrom,TState,TTo](Sequence1& source, Span1 destination, Projection`3 projection, TState& state) in //src/Pipelines.Sockets.Unofficial/Arenas/SequenceExtensions.cs:line 200 at Pipelines.Sockets.Unofficial.Arenas.SequenceExtensions.ToArray[TFrom,TState,TTo](Sequence1& source, Projection3 projection, TState& state) in //src/Pipelines.Sockets.Unofficial/Arenas/SequenceExtensions.cs:line 174 at StackExchange.Redis.ResultProcessor.StreamProcessorBase`1.ParseRedisStreamEntries(RawResult& result) in //src/StackExchange.Redis/ResultProcessor.cs:line 1982 at StackExchange.Redis.ResultProcessor.SingleStreamProcessor.SetResultCore(PhysicalConnection connection, Message message, RawResult& result) in //src/StackExchange.Redis/ResultProcessor.cs:line 1552 at StackExchange.Redis.ResultProcessor.SetResult(PhysicalConnection connection, Message message, RawResult& result) in //src/StackExchange.Redis/ResultProcessor.cs:line 268 at StackExchange.Redis.Message.ComputeResult(PhysicalConnection connection, RawResult& result) in /_/src/StackExchange.Redis/Message.cs:line 623 --- End of stack trace from previous location --- at RedisStreamCacheUpdater`1.GetLatestMsgId()

it may relate to https://github.com/StackExchange/StackExchange.Redis/issues/2117

the operation in GetLastestMsgId is trying to the last entry message id in a stream

var latestMsg = await db.StreamRangeAsync(_typedCacheConfig.Subscription, count: 1, messageOrder: Order.Descending);
return latestMsg.Length > 0 ? ((string?)latestMsg[0].Id) : string.Empty;

Redis server version: 6.0.5 StackExchange.Redis version: 2.2.4 on .NET 6

mjgaux commented 2 months ago

it will be unrelated to 2117 - that's a separate connection and scenario; is this repeatable, i.e. can you repro this reliably on demand? or is this very rare and hard to repro?

mgravell commented 2 months ago

For clarification; ^^^ is also me; I'm testing options to help with the "MSFT touched my GitHub account and now I can't see half of them" single-signin problem.

WeihanLi commented 2 months ago

happened on production, and failed to reproduce in my local environment