-
Notifications
You must be signed in to change notification settings - Fork 42
IndexOutOfRangeException: Index was outside the bounds of the array. at NRedisStack.Search.Document.Load #352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi, I'm having a similar situation. I haven't verified this 100% but as per the docs the results can include missing documents if a ttl is set in some scenarios. |
I spent a bit of time debugging and the exception is occurring here. In my scenario the ret[fieldName] = fields[i + 1]; |
hey @ruwentos @chaimtevel, i understand this exception shows up arbitrarily and we don't have the exact steps to reproduce it, is that correct ? |
For me it was not occurring regularly, but when it does happen it happens fairly consistently till the bad data clears out. If I recall correctly the return data that was causing this was something along these lines: Command:
Results:
If I can replicate then I'll post what the data actually looked like. Thanks! |
hey @ruwentos @chaimtevel , i built a test case(below) to experiment on the behaviour. let me work on it a bit more to tailor the right behavior in [Fact]
public void TestDocumentLoad_Issue352()
{
IDatabase db = redisFixture.Redis.GetDatabase();
db.Execute("FLUSHALL");
var ft = db.FT();
Schema sc = new Schema().AddTextField("first", 1.0).AddTextField("last", 1.0).AddNumericField("age");
Assert.True(ft.Create(index, FTCreateParams.CreateParams(), sc));
db.HashSet("student:1111", new HashEntry[] { new("first", "Joe"), new("last", "Dod"), new("age", 18) });
Assert.True(db.KeyExpire("student:1111", TimeSpan.FromMilliseconds(500)));
Boolean cancelled = false;
Task searchTask = Task.Run(() =>
{
for (int i = 0; i < 100000; i++)
{
SearchResult result = ft.Search(index, new Query());
if (cancelled) break;
}
});
Task.WhenAny(searchTask, Task.Delay(2000)).GetAwaiter().GetResult();
Assert.Null(searchTask.Exception);
cancelled = true;
} |
NRedisStack Version: 0.13.0
Redis Stack Version: 2.8.16
Description: We got an 'Index was outside the bounds of the array' exception at NRedisStack.Search.Document.Load. This happend while we searched Redis with a query through
SearchCommandsAsync.SearchAsync(string indexName, Query q)
.I can test the static function
NRedisStack.Search.Document.Load
and will get this exception every time the parameterRedisValue[]? fields
contains an uneven count of items.So first I thought this would be a flaw in your code. But then I wrote a test that mimics the situation where the exception occurred and I'm not able to reproduce this exception.
What I see is that your code depends on what comes out of
await _db.ExecuteAsync(SearchCommandBuilder.Search(indexName, q))
in yourSearchCommandsAsync
function:My questions:
RedisResult
object was shaped so that your code through an exception?kind regards
Swen
The text was updated successfully, but these errors were encountered: