Open Chr1st1anAML opened 1 year ago
Hi there,
Same problem here, running on .NET 6 on armv7 (LiteDB v5.0.15 and v5.0.17) and there are 2 complete diferent paths:
[ERROR][14][2023-11-07 11:03:59][Error] System.Exception: LiteDB ENSURE: ReadFull must read PAGE_SIZE bytes [0]
at LiteDB.Constants.ENSURE(Boolean conditional, String message)
at LiteDB.Engine.DiskService.ReadFull(FileOrigin origin)+MoveNext()
at LiteDB.Engine.WalIndexService.<>c__DisplayClass19_0.<
and
[ERROR][1][2023-11-07 10:13:07][Error] System.Exception: LiteDB ENSURE: ReadFull must read PAGE_SIZE bytes [0] at LiteDB.Constants.ENSURE(Boolean conditional, String message) at LiteDB.Engine.DiskService.ReadFull(FileOrigin origin)+MoveNext() at LiteDB.Engine.WalIndexService.RestoreIndex(HeaderPage& header) at LiteDB.Engine.LiteEngine..ctor(EngineSettings settings) at LiteDB.ConnectionString.CreateEngine() at LiteDB.LiteDatabase..ctor(ConnectionString connectionString, BsonMapper mapper) (...)
Context:
I was using LiteDB inside a static class, which had a Initialized method called once, that instantiates a global access LiteDatabase object, and the application always reuses the same object. This method never had the above exception, but sometimes the application has big data losses, where the database saves no documents. As this is an embedded restricted device, i have no runtime exception logs on if there is an exception when this happens.
After that, I've change this same class to declare
using var db = new LiteDatabase(_dbFilePath);
In every method to access database, and since then this exception occurrs very often.
What are people doing about this? I just moved my work to LiteDB, and will be moving away from it due to this issue. In this line num = 0, so it catches. I have one method on one thread which does all of my crud operations and opens it for read/write, the rest of them open it read only on another thread. There seems to be no guidance on the numerous issues I've seen opened on this other than 'delete all ' is slow, but I'm not deleting anything yet, just adding objects and trying to read them. Constants.ENSURE(num == 8192, "ReadFull must read PAGE_SIZE bytes [{0}]", num);
LiteDB v5.16 .NET 4.8
How can if fix that? Itryed litteraly EVERYTHING. Nothing worked.