BIMserver icon indicating copy to clipboard operation
BIMserver copied to clipboard

Using Bimsie1LowLevelInterface to modify the model breaks the model

Open dlabz opened this issue 10 years ago • 2 comments

BIMserver: 1.4.0+ Java: 8 OS: Windows test model: Ifc Open House

I used Bimsie1LowLevelInterface.setStringAttribute to add a "Name" attribute to IfcBuilding object, but the issue seems to happen on all functions that modify the model.

After modification, model has unfollowable references, so geometry can't be generated and generated IFC file is unusable.

Trying to generate geometry using IfcOpenShell gives following error in bimserver log:

17-08-2015 14:09:35 ERROR                                                                                  (org.bimserver.longaction.LongDownloadAction.java:68) 
org.bimserver.database.BimserverDatabaseException: org.bimserver.emf.IfcModelInterfaceException: Oid already stored: 66156 org.bimserver.models.ifc2x3tc1.impl.IfcShapeRepresentationImpl@141b5e70 (old: org.bimserver.models.ifc2x3tc1.impl.IfcShapeRepresentationImpl@5fb91693
    at org.bimserver.database.DatabaseSession.convertByteArrayToObject(DatabaseSession.java:243)
    at org.bimserver.database.DatabaseSession.getMap(DatabaseSession.java:1020)
    at org.bimserver.database.DatabaseSession.getMap(DatabaseSession.java:1067)
    at org.bimserver.database.DatabaseSession.getAllOfTypes(DatabaseSession.java:816)
    at org.bimserver.database.actions.DownloadByJsonQueryDatabaseAction.processQueryPart(DownloadByJsonQueryDatabaseAction.java:180)
    at org.bimserver.database.actions.DownloadByJsonQueryDatabaseAction.execute(DownloadByJsonQueryDatabaseAction.java:118)
    at org.bimserver.database.actions.DownloadByJsonQueryDatabaseAction.execute(DownloadByJsonQueryDatabaseAction.java:1)
    at org.bimserver.database.DatabaseSession.executeAndCommitAction(DatabaseSession.java:593)
    at org.bimserver.database.DatabaseSession.executeAndCommitAction(DatabaseSession.java:585)
    at org.bimserver.longaction.LongDownloadOrCheckoutAction.executeAction(LongDownloadOrCheckoutAction.java:118)
    at org.bimserver.longaction.LongDownloadAction.execute(LongDownloadAction.java:63)
    at org.bimserver.longaction.LongActionManager$1.run(LongActionManager.java:43)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.bimserver.emf.IfcModelInterfaceException: Oid already stored: 66156 org.bimserver.models.ifc2x3tc1.impl.IfcShapeRepresentationImpl@141b5e70 (old: org.bimserver.models.ifc2x3tc1.impl.IfcShapeRepresentationImpl@5fb91693
    at org.bimserver.ifc.IfcModel.add(IfcModel.java:376)
    at org.bimserver.ifc.IfcModel.addAllowMultiModel(IfcModel.java:362)
    at org.bimserver.database.DatabaseSession.convertByteArrayToObject(DatabaseSession.java:241)
    ... 12 more

Trying to generate IFC file will generate invalid file, giving following errors in bimserver log:

17-08-2015 14:09:35 ERROR Invalid downloadId: 1                                                            (org.bimserver.servlets.DownloadServlet.java:220) 
17-08-2015 14:10:58 INFO  Inefficient getMap                                                               (org.bimserver.database.DatabaseSession.java:1097) 
17-08-2015 14:10:58 INFO  Unfollowable reference found from org.bimserver.models.ifc2x3tc1.impl.IfcStyledItemImpl@32966155(328358).Styles to org.bimserver.models.ifc2x3tc1.impl.IfcPresentationStyleAssignmentImpl@639a52a0(721387) (org.bimserver.ifc.step.serializer.IfcStepSerializer.java:469) 
17-08-2015 14:10:58 INFO  Unfollowable reference found from org.bimserver.models.ifc2x3tc1.impl.IfcShapeRepresentationImpl@49a39eb7(524908).Items to org.bimserver.models.ifc2x3tc1.impl.IfcFaceBasedSurfaceModelImpl@7af21e65(65865) (org.bimserver.ifc.step.serializer.IfcStepSerializer.java:469) 
17-08-2015 14:10:58 INFO  Unfollowable reference found from org.bimserver.models.ifc2x3tc1.impl.IfcStyledItemImpl@7a0bbe04(393894).Styles to org.bimserver.models.ifc2x3tc1.impl.IfcPresentationStyleAssignmentImpl@6ed4acb8(262635) (org.bimserver.ifc.step.serializer.IfcStepSerializer.java:469) 
17-08-2015 14:10:58 INFO  Unfollowable reference found from org.bimserver.models.ifc2x3tc1.impl.IfcShapeRepresentationImpl@6f6a3d7c(590444).Items to org.bimserver.models.ifc2x3tc1.impl.IfcPolylineImpl@4205c23c(1311197) (org.bimserver.ifc.step.serializer.IfcStepSerializer.java:469) 
17-08-2015 14:10:58 INFO  Unfollowable reference found from org.bimserver.models.ifc2x3tc1.impl.IfcShapeRepresentationImpl@2cc7b9f2(131692).Items to org.bimserver.models.ifc2x3tc1.impl.IfcExtrudedAreaSolidImpl@b7a98f8(1245511) (org.bimserver.ifc.step.serializer.IfcStepSerializer.java:469) 
17-08-2015 14:10:58 INFO  Unfollowable reference found from org.bimserver.models.ifc2x3tc1.impl.IfcShapeRepresentationImpl@55796f82(197228).Items to org.bimserver.models.ifc2x3tc1.impl.IfcExtrudedAreaSolidImpl@371a3094(721223) (org.bimserver.ifc.step.serializer.IfcStepSerializer.java:469) 
17-08-2015 14:10:58 INFO  Unfollowable reference found from org.bimserver.models.ifc2x3tc1.impl.IfcProductDefinitionShapeImpl@765c5c06(2490863).Representations to org.bimserver.models.ifc2x3tc1.impl.IfcShapeRepresentationImpl@39f7d86f(2425452) (org.bimserver.ifc.step.serializer.IfcStepSerializer.java:469) 
17-08-2015 14:10:58 INFO  Unfollowable reference found from org.bimserver.models.ifc2x3tc1.impl.IfcProductDefinitionShapeImpl@245dd880(2556399).Representations to org.bimserver.models.ifc2x3tc1.impl.IfcShapeRepresentationImpl@1a2cfe5(2032236) (org.bimserver.ifc.step.serializer.IfcStepSerializer.java:469) 
17-08-2015 14:10:58 INFO  Unfollowable reference found from org.bimserver.models.ifc2x3tc1.impl.IfcRelAssociatesMaterialImpl@5a488d39(66098).RelatedObjects to org.bimserver.models.ifc2x3tc1.impl.IfcWallStandardCaseImpl@137b9d55(197357) (org.bimserver.ifc.step.serializer.IfcStepSerializer.java:469) 
17-08-2015 14:10:58 INFO  Unfollowable reference found from org.bimserver.models.ifc2x3tc1.impl.IfcRelAssociatesMaterialImpl@5a488d39(66098).RelatedObjects to org.bimserver.models.ifc2x3tc1.impl.IfcWallStandardCaseImpl@54def777(66285) (org.bimserver.ifc.step.serializer.IfcStepSerializer.java:469) 
17-08-2015 14:10:58 INFO  Unfollowable reference found from org.bimserver.models.ifc2x3tc1.impl.IfcRelAssociatesMaterialImpl@5a488d39(66098).RelatedObjects to org.bimserver.models.ifc2x3tc1.impl.IfcWallStandardCaseImpl@4a619990(262893) (org.bimserver.ifc.step.serializer.IfcStepSerializer.java:469) 
17-08-2015 14:10:58 INFO  Unfollowable reference found from org.bimserver.models.ifc2x3tc1.impl.IfcRelAssociatesMaterialImpl@5a488d39(66098).RelatedObjects to org.bimserver.models.ifc2x3tc1.impl.IfcWallStandardCaseImpl@5af4559d(131821) (org.bimserver.ifc.step.serializer.IfcStepSerializer.java:469) 
17-08-2015 14:10:58 INFO  Unfollowable reference found from org.bimserver.models.ifc2x3tc1.impl.IfcProductDefinitionShapeImpl@6bac443e(2097647).Representations to org.bimserver.models.ifc2x3tc1.impl.IfcShapeRepresentationImpl@50de40a8(1770092) (org.bimserver.ifc.step.serializer.IfcStepSerializer.java:469) 
17-08-2015 14:10:58 INFO  Unfollowable reference found from org.bimserver.models.ifc2x3tc1.impl.IfcProductDefinitionShapeImpl@3f321f7e(2163183).Representations to org.bimserver.models.ifc2x3tc1.impl.IfcShapeRepresentationImpl@4d0ac4db(1573484) (org.bimserver.ifc.step.serializer.IfcStepSerializer.java:469) 
17-08-2015 14:10:58 INFO  Unfollowable reference found from org.bimserver.models.ifc2x3tc1.impl.IfcProductDefinitionShapeImpl@1a404da8(1704431).Representations to org.bimserver.models.ifc2x3tc1.impl.IfcShapeRepresentationImpl@2d858e1d(1901164) (org.bimserver.ifc.step.serializer.IfcStepSerializer.java:469) 
17-08-2015 14:10:58 INFO  Unfollowable reference found from org.bimserver.models.ifc2x3tc1.impl.IfcProductDefinitionShapeImpl@6ccc474c(1769967).Representations to org.bimserver.models.ifc2x3tc1.impl.IfcShapeRepresentationImpl@396de113(1311340) (org.bimserver.ifc.step.serializer.IfcStepSerializer.java:469) 
17-08-2015 14:10:58 INFO  Unfollowable reference found from org.bimserver.models.ifc2x3tc1.impl.IfcRelContainedInSpatialStructureImpl@5f9dcf7c(787006).RelatedElements to org.bimserver.models.ifc2x3tc1.impl.IfcStairFlightImpl@19e52249(66176) (org.bimserver.ifc.step.serializer.IfcStepSerializer.java:469) 
17-08-2015 14:10:58 INFO  Unfollowable reference found from org.bimserver.models.ifc2x3tc1.impl.IfcProductDefinitionShapeImpl@2668957(1311215).Representations to org.bimserver.models.ifc2x3tc1.impl.IfcShapeRepresentationImpl@4196788a(1376876) (org.bimserver.ifc.step.serializer.IfcStepSerializer.java:469) 
17-08-2015 14:10:58 INFO  Unfollowable reference found from org.bimserver.models.ifc2x3tc1.impl.IfcProductDefinitionShapeImpl@3e09df6(1376751).Representations to org.bimserver.models.ifc2x3tc1.impl.IfcShapeRepresentationImpl@4954f06d(197228) (org.bimserver.ifc.step.serializer.IfcStepSerializer.java:469) 
17-08-2015 14:10:58 INFO  Unfollowable reference found from org.bimserver.models.ifc2x3tc1.impl.IfcOpenShellImpl@1a7ad3ba(65979).CfsFaces to org.bimserver.models.ifc2x3tc1.impl.IfcFaceImpl@1531e470(2228552) (org.bimserver.ifc.step.serializer.IfcStepSerializer.java:469) 
17-08-2015 14:10:58 INFO  Unfollowable reference found from org.bimserver.models.ifc2x3tc1.impl.IfcOpenShellImpl@1a7ad3ba(65979).CfsFaces to org.bimserver.models.ifc2x3tc1.impl.IfcFaceImpl@58004137(15335752) (org.bimserver.ifc.step.serializer.IfcStepSerializer.java:469) 
17-08-2015 14:10:58 INFO  Unfollowable reference found from org.bimserver.models.ifc2x3tc1.impl.IfcOpenShellImpl@1a7ad3ba(65979).CfsFaces to org.bimserver.models.ifc2x3tc1.impl.IfcFaceImpl@14abbe8e(27263304) 
...

dlabz avatar Aug 17 '15 12:08 dlabz

Looking further in to this issue, it seems that setting a property of an object creates a duplicate database entry. To prove that this is the case, I made a second modification to a model broken in the first example, and now I get double error when trying to generate geometry:

26-08-2015 20:12:42 ERROR                                                                                  (org.bimserver.longaction.LongAction.java:185) 
org.bimserver.database.BimserverDatabaseException: org.bimserver.emf.IfcModelInterfaceException: Oid already stored: 66156 org.bimserver.models.ifc2x3tc1.impl.IfcShapeRepresentationImpl@1d5109ec (old: org.bimserver.models.ifc2x3tc1.impl.IfcShapeRepresentationImpl@1eaad89
    at org.bimserver.database.DatabaseSession.convertByteArrayToObject(DatabaseSession.java:243)
    at org.bimserver.database.DatabaseSession.getMap(DatabaseSession.java:1020)
    at org.bimserver.database.DatabaseSession.getMap(DatabaseSession.java:1067)
    at org.bimserver.database.DatabaseSession.getAllOfTypes(DatabaseSession.java:816)
    at org.bimserver.database.actions.DownloadByJsonQueryDatabaseAction.processQueryPart(DownloadByJsonQueryDatabaseAction.java:180)
    at org.bimserver.database.actions.DownloadByJsonQueryDatabaseAction.execute(DownloadByJsonQueryDatabaseAction.java:118)
    at org.bimserver.database.actions.DownloadByJsonQueryDatabaseAction.execute(DownloadByJsonQueryDatabaseAction.java:1)
    at org.bimserver.database.DatabaseSession.executeAndCommitAction(DatabaseSession.java:593)
    at org.bimserver.database.DatabaseSession.executeAndCommitAction(DatabaseSession.java:585)
    at org.bimserver.longaction.LongDownloadOrCheckoutAction.executeAction(LongDownloadOrCheckoutAction.java:118)
    at org.bimserver.longaction.LongDownloadAction.execute(LongDownloadAction.java:63)
    at org.bimserver.longaction.LongActionManager$1.run(LongActionManager.java:43)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.bimserver.emf.IfcModelInterfaceException: Oid already stored: 66156 org.bimserver.models.ifc2x3tc1.impl.IfcShapeRepresentationImpl@1d5109ec (old: org.bimserver.models.ifc2x3tc1.impl.IfcShapeRepresentationImpl@1eaad89
    at org.bimserver.ifc.IfcModel.add(IfcModel.java:376)
    at org.bimserver.ifc.IfcModel.addAllowMultiModel(IfcModel.java:362)
    at org.bimserver.database.DatabaseSession.convertByteArrayToObject(DatabaseSession.java:241)
    ... 12 more
26-08-2015 20:12:42 ERROR                                                                                  (org.bimserver.longaction.LongDownloadAction.java:68) 
org.bimserver.database.BimserverDatabaseException: org.bimserver.emf.IfcModelInterfaceException: Oid already stored: 66156 org.bimserver.models.ifc2x3tc1.impl.IfcShapeRepresentationImpl@1d5109ec (old: org.bimserver.models.ifc2x3tc1.impl.IfcShapeRepresentationImpl@1eaad89
    at org.bimserver.database.DatabaseSession.convertByteArrayToObject(DatabaseSession.java:243)
    at org.bimserver.database.DatabaseSession.getMap(DatabaseSession.java:1020)
    at org.bimserver.database.DatabaseSession.getMap(DatabaseSession.java:1067)
    at org.bimserver.database.DatabaseSession.getAllOfTypes(DatabaseSession.java:816)
    at org.bimserver.database.actions.DownloadByJsonQueryDatabaseAction.processQueryPart(DownloadByJsonQueryDatabaseAction.java:180)
    at org.bimserver.database.actions.DownloadByJsonQueryDatabaseAction.execute(DownloadByJsonQueryDatabaseAction.java:118)
    at org.bimserver.database.actions.DownloadByJsonQueryDatabaseAction.execute(DownloadByJsonQueryDatabaseAction.java:1)
    at org.bimserver.database.DatabaseSession.executeAndCommitAction(DatabaseSession.java:593)
    at org.bimserver.database.DatabaseSession.executeAndCommitAction(DatabaseSession.java:585)
    at org.bimserver.longaction.LongDownloadOrCheckoutAction.executeAction(LongDownloadOrCheckoutAction.java:118)
    at org.bimserver.longaction.LongDownloadAction.execute(LongDownloadAction.java:63)
    at org.bimserver.longaction.LongActionManager$1.run(LongActionManager.java:43)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.bimserver.emf.IfcModelInterfaceException: Oid already stored: 66156 org.bimserver.models.ifc2x3tc1.impl.IfcShapeRepresentationImpl@1d5109ec (old: org.bimserver.models.ifc2x3tc1.impl.IfcShapeRepresentationImpl@1eaad89
    at org.bimserver.ifc.IfcModel.add(IfcModel.java:376)
    at org.bimserver.ifc.IfcModel.addAllowMultiModel(IfcModel.java:362)
    at org.bimserver.database.DatabaseSession.convertByteArrayToObject(DatabaseSession.java:241)
    ... 12 more

So, now the model seems to have 3 instances of object with oid 66156.

dlabz avatar Aug 26 '15 18:08 dlabz

With BIMserver 1.5.149-SNAPSHOT, I see slightly different strange behaviour. Edit: not reproducible with 1.5.147.

I used the IFC4 Wall with window example and tried to change the IfcBuilding.Name attribute using LowLevelInterface.setStringAttribute.

This is what happens:

  • In the new revision, there is an object with original OID where the attribute value is changed.
  • In the new revision, there is a copy with a new OID where the attribute has the old value.
  • In the old revision, the object is unchanged with original OID and old value.
  • The duplication takes place for many (probably all) unaffected objects of the original revision as well.

IFC export does work well nevertheless, but all the duplications appear in the export. I did not test geometry generation.

The duplication does not happen if the attribute is unset before setting it again, no matter whether in one transaction or two separate transactions. This seems to be a viable workaround.

hlg avatar Jun 28 '19 11:06 hlg