LiteDB icon indicating copy to clipboard operation
LiteDB copied to clipboard

[Bug] System.Exception: LiteDB ENSURE: get only index below highest index

Open srinicrick65 opened this issue 2 years ago • 8 comments

Version We used both 5.0.11 and 5.0.12

Describe the bug We are trying to read the data from the LiteDB Collection using GetEntityCollection and we are getting the below exception

fail: Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[1] An unhandled exception has occurred while executing the request. 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(PageAddress address)+MoveNext() at LiteDB.Engine.BufferReader..ctor(IEnumerable1 source, Boolean utcDate) at LiteDB.Engine.DatafileLookup.Load(PageAddress rawId) at LiteDB.Engine.BasePipe.LoadDocument(IEnumerable1 nodes)+MoveNext() at LiteDB.Engine.QueryPipe.Select(IEnumerable1 source, BsonExpression select)+MoveNext() at LiteDB.Engine.QueryExecutor.<>c__DisplayClass10_0.<<ExecuteQuery>g__RunQuery|0>d.MoveNext() at LiteDB.BsonDataReader.Read() at LiteDB.LiteQueryable1.ToDocuments()+MoveNext() at System.Linq.Enumerable.SelectEnumerableIterator2.ToList() at Cloud.IAMMiddleware.DataAccess.LiteDbService1.GetEntityCollection(Int32 pagenumber, Int32 pagesize, String sortParam, String queryParamFilter)

Expected behavior Ideal scenario is it should be fetching the data from the LiteDB.

Screenshots/Stacktrace image

srinicrick65 avatar Dec 09 '22 08:12 srinicrick65

Hi Team Can someone provide response this ?

srinicrick65 avatar Dec 13 '22 14:12 srinicrick65

Some sample code to reproduce? Or at least a data model.

ProKn1fe avatar Dec 15 '22 20:12 ProKn1fe

Hi @ProKn1fe We are performing basic CRUD operation . Sample model looks as below .

{
	"_id" : "802d5b66-b35b-483d-ae2b-ac3b09c7de82",
	"tags" : [ ],
	"deletedAt" : 0,
	"ctd" : true,
	"lmd" : 1670658945379,
	"cid" : "eed86ec6-fd4e-4279-b7f2-d7f732b5d62a",
	"scope" : "region",
	"name" : "Ability admin",
	"permissions" : [
		"solution_create",
		"solution_read",
		"solution_write",
		"solution_delete",
		"app_create",
		"app_read",
		"app_write",
		"app_delete",
		"tenant_create",
		"tenant_read",
		"tenant_write",
		"tenant_delete",
		"contract_create",
		"contract_read",
		"contract_write",
		"contract_delete",
		"user_create",
		"user_read",
		"user_write",
		"user_delete",
		"group_create",
		"group_read",
		"group_write",
		"group_delete",
		"identity_provider_create",
		"identity_provider_read",
		"identity_provider_write",
		"identity_provider_delete",
		"connectivity_provider_create",
		"connectivity_provider_read",
		"connectivity_provider_write",
		"connectivity_provider_delete",
		"role_create",
		"role_read",
		"role_write",
		"role_delete",
		"grant_create",
		"grant_read",
		"grant_write",
		"grant_delete",
		"permission_create",
		"permission_read",
		"permission_write",
		"permission_delete",
		"resource_create",
		"resource_read",
		"resource_write",
		"resource_delete",
		"operation_create",
		"operation_read",
		"operation_write",
		"operation_delete",
		"audit_log_read"
	],
	"solutionId" : "30304e0f-af6d-480c-ae94-1d6c136ec94d"
}

srinicrick65 avatar Dec 17 '22 18:12 srinicrick65

Facing similar issue @mbdavid - This issue is a blocker for our release.

image

shubhiroy avatar Apr 02 '23 15:04 shubhiroy

I made the same mistake.

coooool avatar Jun 03 '23 15:06 coooool

What mistake @coooool ?

shubhiroy avatar Aug 02 '23 12:08 shubhiroy