# Application crashes when importing this specific IFC file.

**URL:** <https://forums.buildingsmart.org/t/application-crashes-when-importing-this-specific-ifc-file/4523>\
**Category:** IFC\
**Created:** [December 7, 2022, 4:17am UTC](https://forums.buildingsmart.org/t/application-crashes-when-importing-this-specific-ifc-file/4523 "2022-12-07T04:17:08Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![OmkarShembekar](https://avatars.discourse-cdn.com/v4/letter/o/b9bd4f/32.png) [@OmkarShembekar](https://forums.buildingsmart.org/u/OmkarShembekar)\
**Post date:** [December 7, 2022, 4:17am UTC](https://forums.buildingsmart.org/t/application-crashes-when-importing-this-specific-ifc-file/4523/1 "2022-12-07T04:17:08Z")

</div>

Tried importing this particular IFC files in multiple (online / desktop) IFC viewers and almost all applications crashed. Even ‘ifcviewer-C++\_64bit\_Unicode.exe’ crashes. After investigating it was found that ‘ **stack overflow** ’ exception is thrown from **IFCEngine.dll (version 1.0.1.1481)** while executing ‘ **getInstanceDerivedTransformationMatrix** ’ API.  
Tried to handle this crash using try-catch exception handling but it did not catch the exception because it is ‘operating system’ level exception and not C++ exception.

IFC FILE\_SCHEMA - ‘IFC4X1’

Need help in solving this exception on IFCEngine side.

**PS:** Currently this forum doesn’t allow me to upload the IFC file as I am a new user. Will upload the file as soon as it allows me to do so.

---

<div class="post-metadata">

**Author:** ![aothms](https://avatars.discourse-cdn.com/v4/letter/a/c67d28/32.png) [@aothms](https://forums.buildingsmart.org/u/aothms)\
**Post date:** [December 8, 2022, 7:29pm UTC](https://forums.buildingsmart.org/t/application-crashes-when-importing-this-specific-ifc-file/4523/2 "2022-12-08T19:29:28Z")

</div>

IFC uses relative placements. Is there any chance there is a cyclic definition in the model that causes an infinite loop when evaluating (hence a stack overflow)? That’s what I would piece together from the information provided.

If that were the case, the following python script would also overflow the stack:

```auto
import ifcopenshell
f = ifcopenshell.open(...)
for inst in f.by_type('IfcObjectPlacement'):
  print(inst.get_info(recursive=True))

```

---

<div class="post-metadata">

**Author:** ![OmkarShembekar](https://avatars.discourse-cdn.com/v4/letter/o/b9bd4f/32.png) [@OmkarShembekar](https://forums.buildingsmart.org/u/OmkarShembekar)\
**Post date:** [December 9, 2022, 5:02am UTC](https://forums.buildingsmart.org/t/application-crashes-when-importing-this-specific-ifc-file/4523/3 "2022-12-09T05:02:56Z")

</div>

Thanks for your reply Thomas 👍🏻 Even I am guessing that file has something cyclic in it. The file is so big that its difficult to find the possible cyclic structure in it. Some how I am not able to provide the file (because of the restriction imposed by buildingsmart of uploading file to new users).  
I forgot to mention that I am using C++ and the exception caught by the API _getInstanceDerivedTransformationMatrix_ is not caught in try catch expression. Is there any alternative for above API? or any newer version of IFCEngine.dll which has handled this kind of exception inside IFCEngine code? any more information is appreciated…

---

<div class="post-metadata">

**Author:** ![aothms](https://avatars.discourse-cdn.com/v4/letter/a/c67d28/32.png) [@aothms](https://forums.buildingsmart.org/u/aothms)\
**Post date:** [December 9, 2022, 8:01am UTC](https://forums.buildingsmart.org/t/application-crashes-when-importing-this-specific-ifc-file/4523/4 "2022-12-09T08:01:52Z")

</div>

Keep in mind that this a forum generically about IFC not about any particular implementation. @PeterBonsma will be able to tell you more about IFCEngine.dll but indeed a stack overflow exception in native code cannot be handled. If the issue is not due to infinite recursion you can increase the size of the stack (in windows I think this is a compile time setting, on linux I think runtime).

---

<div class="post-metadata">

**Author:** ![PeterBonsma](https://avatars.discourse-cdn.com/v4/letter/p/ac8455/32.png) [@PeterBonsma](https://forums.buildingsmart.org/u/PeterBonsma)\
**Post date:** [December 9, 2022, 8:17am UTC](https://forums.buildingsmart.org/t/application-crashes-when-importing-this-specific-ifc-file/4523/5 "2022-12-09T08:17:30Z")

</div>

@OmkarShembekar, if you could send the IFC file to me (peter@rdf.bg) I can have a look. It could be indeed many things, including a bug on our side.

Thanks

---

<div class="post-metadata">

**Author:** ![OmkarShembekar](https://avatars.discourse-cdn.com/v4/letter/o/b9bd4f/32.png) [@OmkarShembekar](https://forums.buildingsmart.org/u/OmkarShembekar)\
**Post date:** [December 9, 2022, 8:24am UTC](https://forums.buildingsmart.org/t/application-crashes-when-importing-this-specific-ifc-file/4523/6 "2022-12-09T08:24:02Z")

</div>

Sure Peter. I will send the file directly to you. Thanks for the help.

---

<div class="post-metadata">

**Author:** ![OmkarShembekar](https://avatars.discourse-cdn.com/v4/letter/o/b9bd4f/32.png) [@OmkarShembekar](https://forums.buildingsmart.org/u/OmkarShembekar)\
**Post date:** [December 9, 2022, 8:24am UTC](https://forums.buildingsmart.org/t/application-crashes-when-importing-this-specific-ifc-file/4523/7 "2022-12-09T08:24:35Z")

</div>

Sure. Thanks Thomas for pointing me to the correct person. Appreciate your time and help.

---

<div class="post-metadata">

**Author:** ![igor.sokolov](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.buildingsmart.org/igor.sokolov/32/25_2.png) [@igor.sokolov](https://forums.buildingsmart.org/u/igor.sokolov)\
**Post date:** [December 13, 2022, 8:33am UTC](https://forums.buildingsmart.org/t/application-crashes-when-importing-this-specific-ifc-file/4523/8 "2022-12-13T08:33:18Z")

</div>

Generally, please note that IFC4x1 is withdrawn.  
Can you change to IFC4 ADD2 TC1 or at least IFC4.3 TC1?

---

<div class="post-metadata">

**Author:** ![OmkarShembekar](https://avatars.discourse-cdn.com/v4/letter/o/b9bd4f/32.png) [@OmkarShembekar](https://forums.buildingsmart.org/u/OmkarShembekar)\
**Post date:** [December 19, 2022, 10:32am UTC](https://forums.buildingsmart.org/t/application-crashes-when-importing-this-specific-ifc-file/4523/9 "2022-12-19T10:32:35Z")

</div>

@igor.sokolov , @aothms - This issue was resolved with the latest IFCEngine.dll (version 1606). Thanks to @PeterBonsma for the solution 👍🏻
