LiteDB icon indicating copy to clipboard operation
LiteDB copied to clipboard

[BUG] Non-negative number required. Error when querying the database

Open arunprakashn opened this issue 1 year ago • 4 comments

Version Which LiteDB version/OS/.NET framework version are you using. (REQUIRED) 5.0.9

Describe the bug A clear and concise description of what the bug is. Getting the following exception.

Non-negative number required. Parameter name: count  System.ArgumentOutOfRangeException: Non-negative number required. Parameter name: count at System.Buffer.BlockCopy(Array src, Int32 srcOffset, Array dst, Int32 dstOffset, Int32 count) at LiteDB.Engine.BufferReader.Read(Byte[] buffer, Int32 offset, Int32 count) at LiteDB.Engine.BufferReader.ReadNumber[T](Func3 convert, Int32 size) at LiteDB.Engine.BufferReader.ReadDocument(HashSet1 fields) at LiteDB.Engine.DatafileLookup.Load(PageAddress rawId) at LiteDB.Engine.BasePipe.<LoadDocument>d__6.MoveNext() at LiteDB.Engine.BasePipe.<Filter>d__8.MoveNext() at LiteDB.Engine.QueryPipe.<Select>d__2.MoveNext() at LiteDB.Engine.QueryExecutor.<>c__DisplayClass10_0.<<ExecuteQuery>g__RunQuery|0>d.MoveNext() at LiteDB.BsonDataReader.Read() at LiteDB.LiteQueryable1.<ToDocuments>d__26.MoveNext() at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext() at System.Linq.Enumerable.Count[TSource](IEnumerable1 source) at Platform.IHC.OHS.Data.Repository.BaseRepository1.Find(Expression`1 predicate, Int32 skip, Int32 limit, Boolean autoSlideEnabled, DataBaseType activeDbMode, DataBaseCategory dataBaseCategory) at OHS.Module.Common.Jobs.DataFeedSubscriptionJob.ProcessSubscriptionRequest() at OHS.Module.Common.Jobs.DataFeedSubscriptionJob.<Execute>d__5.MoveNext()

Code to Reproduce Write a small snippet to isolate your bug and could be possible to our team test. (REQUIRED)

Expected behavior A clear and concise description of what you expected to happen.

Screenshots/Stacktrace If applicable, add screenshots/stacktrace

Additional context Add any other context about the problem here.

We saw a similar issue https://github.com/mbdavid/LiteDB/issues/1378 but I believe that the fix for this is already in 5.0.9. Hence, this is a new issue albeit the error is the same

arunprakashn avatar Jun 09 '23 05:06 arunprakashn

Any help?

arunprakashn avatar Jul 07 '23 08:07 arunprakashn

Any inputs? We are seeing this more often now.

arunprakashn avatar Jul 18 '23 02:07 arunprakashn

When using the latest library, the exception is a little different LiteDB ENSURE: get only index below highest index  System.Exception: LiteDB ENSURE: get only index below highest index at LiteDB.Constants.ENSURE(Boolean conditional, String message) at LiteDB.Engine.BasePage.Get(Byte index) at LiteDB.Engine.DataService.<Read>d__5.MoveNext() at LiteDB.Engine.BufferReader..ctor(IEnumerable1 source, Boolean utcDate) at LiteDB.Engine.DatafileLookup.Load(PageAddress rawId) at LiteDB.Engine.BasePipe.<LoadDocument>d__6.MoveNext() at LiteDB.Engine.BasePipe.<Filter>d__8.MoveNext() at LiteDB.Engine.QueryPipe.<Select>d__2.MoveNext() at LiteDB.Engine.QueryExecutor.<>c__DisplayClass10_0.<<ExecuteQuery>g__RunQuery|0>d.MoveNext() at LiteDB.BsonDataReader..ctor(IEnumerable1 values, String collection) at LiteDB.Engine.QueryExecutor.ExecuteQuery(Boolean executionPlan) at LiteDB.Engine.LiteEngine.Query(String collection, Query query) at LiteDB.LiteQueryable1.<ToDocuments>d__26.MoveNext() at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext() at System.Linq.Enumerable.Count[TSource](IEnumerable`1 source)

arunprakashn avatar Jul 18 '23 05:07 arunprakashn

Any updates?

arunprakashn avatar Nov 22 '23 04:11 arunprakashn