StackExchange.Redis icon indicating copy to clipboard operation
StackExchange.Redis copied to clipboard

Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection

Open Trajanv opened this issue 10 years ago • 2 comments

using (var muxer = ConnectionMultiplexer.Connect("conn-string")) { var key = "anykey"; var stringValue = "about9000charslong";//A very long string value, about 9000 Chars var _cache = muxer.GetDatabase(); _cache.StringSet(key, stringValue);//Throws err here } Error: InternalFailure on SETEX
InnerException "Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection."}

StackTrace:

at System.Buffer.BlockCopy(Array src, Int32 srcOffset, Array dst, Int32 dstOffset, Int32 count) at StackExchange.Redis.BufferedOutputStream.Write(Byte[] buffer, Int32 offset, Int32 count) in ...\StackExchange.Redis\StackExchange\Redis\Compat\BufferedOutputStream.cs:line 88 at StackExchange.Redis.PhysicalConnection.WriteUnified(Stream stream, Byte[] value) in ...\StackExchange.Redis\StackExchange\Redis\PhysicalConnection.cs:line 554 at StackExchange.Redis.PhysicalConnection.Write(RedisValue value) in ...\StackExchange.Redis\StackExchange\Redis\PhysicalConnection.cs:line 454 at StackExchange.Redis.Message.CommandKeyValueMessage.WriteImpl(PhysicalConnection physical) in ...\StackExchange.Redis\StackExchange\Redis\Message.cs:line 939 at StackExchange.Redis.PhysicalBridge.WriteMessageToServer(PhysicalConnection connection, Message message) in ...\StackExchange.Redis\StackExchange\Redis\PhysicalBridge.cs:line 792

Trajanv avatar Apr 07 '16 06:04 Trajanv

As a temporary workaround, we split the long string into batch of 4000 chars, and append [_cache.StringAppend(key, batch[I])] . This seem to be temporary fix.

Trajanv avatar Apr 08 '16 23:04 Trajanv

Closing this issue as its similar to that of InternalFailure on SETEX for large strings #322

Trajanv avatar Apr 13 '16 19:04 Trajanv