xBimTeam / XbimEssentials

A .NET library to work with data in the IFC format. This is the core component of the Xbim Toolkit
https://xbimteam.github.io/
Other
477 stars 171 forks source link

Exception ("Out of table cursors") from Xbim.IO.Esent-6.0.445 , While processing IFC files with size > 150 MB #551

Open CCT-Mukund-Thakare opened 4 months ago

CCT-Mukund-Thakare commented 4 months ago

Hello Team, @martin1cerny @andyward

While processing an IFC files with size > 100 MB, I have observed one issue, on latest XbimEssentials package, I am getting an exception saying that,

Message: Out of table cursors
StackTrace:    at Microsoft.Isam.Esent.Interop.Api.JetOpenTable(JET_SESID sesid, JET_DBID dbid, String tablename, Byte[] parameters, Int32 parametersSize, OpenTableGrbit grbit, JET_TABLEID& tableid)
   at Xbim.IO.Esent.EsentShapeGeometryCursor..ctor(EsentModel model, String database, OpenDatabaseGrbit mode)
   at Xbim.IO.Esent.PersistedEntityInstanceCache.GetShapeGeometryTable()
   at Xbim.IO.Esent.EsentModel.GetShapeGeometryTable()
   at Xbim.IO.Esent.EsentGeometryStoreReader..ctor(EsentModel esentModel)
   at Xbim.IO.Esent.EsentGeometryStore.BeginRead()    

Assemblies and versions affected:

Affected Xbim.Essentials = 6.0.445, 6.0.442

Not Affected Xbim.Essentials = 5.1.341

The issue is not observed on lower versions of Xbim.Essentials.

Steps (or code) to reproduce the issue:

I do have workaround for this, while opening the file with IfcStore, when we pass -1 as an argument. we don't get any exception while processing. var model = IfcStore.Open(inputIfcFilePath, editor, -1)

I do understand, when we pass -1 we are creating the memory model and not database model. That means whenever we try to create the database model for large files we are facing this issue. and ideally for large models database model is efficient.

Let me know your thoughts on this.

Expected behavior:

Large models should be processed without any exception with database models.

andyward commented 4 months ago

Sounds like we regressed something in the EsentModel in the last release.

Possibly related to https://github.com/xBimTeam/XbimEssentials/commit/954f01c7e9af3b4a4189b142aa773dddd6a5d9c7

Are there any public models that can reproduce this issue? Can you share a repo with minimal code showing the issue?

CCT-Mukund-Thakare commented 4 months ago

Hello @andyward I have added the repo to reproduce this bug, please check this link.

You can find the Zipped IFC file in test folder We can reproduce this issue with this file.

In program.cs at line number 47, we can reproduce the issue.

var geomReader = geomstore.BeginRead();

Let me know if you need more information regarding the repo.

Thank you !!