Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cloning a VersionTranslated HeatExchangerAirToAirSensibleAndLatent to another model causes a boost assert failure #5239

Open
jmarrec opened this issue Aug 26, 2024 · 1 comment

Comments

@jmarrec
Copy link
Collaborator

jmarrec commented Aug 26, 2024

Issue overview

Current Behavior

Seems like it's the combination of:

  • Having all TableLookup's using the SAME TableIndependentVariableList
    • const std::string varListHandle = toString(createUUID());
      bool tableAdded = false;
      for (size_t i = 0; i < hx_old_100effectiveness_idxs.size(); ++i) {
      // Sensible/Latent Effectiveness at 100% Heating/Cooling Air Flow {dimensionless}
      if (auto e100 = object.getDouble(hx_old_100effectiveness_idxs[i])) {
      // Sensible/Latent Effectiveness at 75% Heating/Cooling Air Flow {dimensionless}
      if (auto e75 = object.getDouble(hx_old_100effectiveness_idxs[i] + 2)) {
      if (e100.get() != e75.get()) {
      tableAdded = true;
      IdfObject tableLookup(idd_3_8_0.getObject("OS:Table:Lookup").get());
      std::string uuid = toString(createUUID());
      tableLookup.setString(0, uuid); // Handle
      tableLookup.setString(1, fmt::format("{}_{}Eff", object.nameString(), hx_new_table_names[i])); // Name
      tableLookup.setString(2, varListHandle); // Independent Variable List Name
  • Cloning to another model

Expected Behavior

Should not crash

Steps to Reproduce

cd src/osversion/test/3_8_0/, then use the following ruby code

m = OpenStudio::Model::Model.load('test_vt_HeatExchangerAirToAirSensibleAndLatent.osm').get

[8] 3_8_0(main)> m2 = Model.new
=> #<OpenStudio::Model::Model:0x00007f367b2f4000 @__swigtype__="_p_openstudio__model__Model">
[9] 3_8_0(main)> erv = m.getZoneHVACEnergyRecoveryVentilators[0]
=> nil
[10] 3_8_0(main)> hx = m.getHeatExchangerAirToAirSensibleAndLatents.first
=> #<OpenStudio::Model::HeatExchangerAirToAirSensibleAndLatent:0x00007f367b2d4250 @__swigtype__="_p_openstudio__model__HeatExchangerAirToAirSensibleAndLatent">
[11] 3_8_0(main)> hx.clone(m2)
[utilities.idf.Workspace] <-1> Unable to add cloned objects to Workspace. The validity report is: 
The collection is INVALID at strictness level 'Draft', because of the errors:
Object     level data error of type NameConflict      .
Error pertains to an object of type 'OS:ModelObjectList', named 'ERV_IndependentVariableList'.
Additional information about the error type: two objects of the same type or with overlapping references also have the same name.
[BOOST_ASSERT] <2> Assertion it != m_targetData->reversePointers.end() failed on line 1024 of void openstudio::detail::WorkspaceObject_Impl::nullifyReversePointer(const Handle&, unsigned int) in file /srv/jenkins/openstudio/git/nightly/ubuntu_2004/Openstudio/src/utilities/idf/WorkspaceObject.cpp.
[BOOST_ASSERT] <2> Assertion it != m_targetData->reversePointers.end() failed on line 1024 of void openstudio::detail::WorkspaceObject_Impl::nullifyReversePointer(const Handle&, unsigned int) in file /srv/jenkins/openstudio/git/nightly/ubuntu_2004/Openstudio/src/utilities/idf/WorkspaceObject.cpp.

Possible Solution

Details

Environment

Some additional details about your environment for this issue (if relevant):

  • Platform (Operating system, version): All
  • Version of OpenStudio (if using an intermediate build, include SHA): 3.8.0

Context

This was reported on unmethours: https://unmethours.com/question/99873/adding-erv-crashes-openstudio-180-rc1/

@jmarrec
Copy link
Collaborator Author

jmarrec commented Aug 26, 2024

[BOOST_ASSERT] <2> Assertion it != m_targetData->reversePointers.end() failed on line 1024 of void openstudio::detail::WorkspaceObject_Impl::nullifyReversePointer(const Handle&, unsigned int) in file /home/julien/Software/Others/OpenStudio/src/utilities/idf/WorkspaceObject.cpp.
[BOOST_ASSERT] <2> Assertion it != m_targetData->reversePointers.end() failed on line 1024 of void openstudio::detail::WorkspaceObject_Impl::nullifyReversePointer(const Handle&, unsigned int) in file /home/julien/Software/Others/OpenStudio/src/utilities/idf/WorkspaceObject.cpp.
OpenStudioApp: /home/julien/Software/Others/OS-build/_CPack_Packages/Linux/TGZ/OpenStudio-3.8.0-rc2+fb533a2bbb-Ubuntu-20.04-x86_64/usr/local/openstudio-3.8.0-rc2/include/openstudio/utilities/core/Assert.hpp:37: void boost::assertion_failed(const char*, const char*, const char*, long int): Assertion `false' failed.
Process 2645879 stopped
* thread #1, name = 'OpenStudioApp', stop reason = hit program assert
    frame #4: 0x0000555555a0574b OpenStudioApp`boost::assertion_failed(expr="it != m_targetData->reversePointers.end()", function="void openstudio::detail::WorkspaceObject_Impl::nullifyReversePointer(const Handle&, unsigned int)", file="/home/julien/Software/Others/OpenStudio/src/utilities/idf/WorkspaceObject.cpp", line=1024) at Assert.hpp:37:3
   34  	  ss << "Assertion " << expr << " failed on line " << line << " of " << function << " in file " << file << ".";
   35  	  openstudio::Logger::instance().standardErrLogger().enable();
   36  	  LOG_FREE(Fatal, "BOOST_ASSERT", ss.str());
-> 37  	  assert(false);
   38  	}
   39  	
   40  	inline void assertion_failed_msg(char const* expr, char const* msg, char const* function, char const* file, long line) {
(lldb) bt
* thread #1, name = 'OpenStudioApp', stop reason = hit program assert
    frame #0: 0x00007fffe274300b libc.so.6`__GI_raise(sig=<unavailable>) at raise.c:51:1
    frame #1: 0x00007fffe2722859 libc.so.6`__GI_abort at abort.c:79:7
    frame #2: 0x00007fffe2722729 libc.so.6`__assert_fail_base(fmt="%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion="false", file="/home/julien/Software/Others/OS-build/_CPack_Packages/Linux/TGZ/OpenStudio-3.8.0-rc2+fb533a2bbb-Ubuntu-20.04-x86_64/usr/local/openstudio-3.8.0-rc2/include/openstudio/utilities/core/Assert.hpp", line=37, function="void boost::assertion_failed(const char*, const char*, const char*, long int)") at assert.c:92:3
    frame #3: 0x00007fffe2733fd6 libc.so.6`__GI___assert_fail(assertion="false", file="/home/julien/Software/Others/OS-build/_CPack_Packages/Linux/TGZ/OpenStudio-3.8.0-rc2+fb533a2bbb-Ubuntu-20.04-x86_64/usr/local/openstudio-3.8.0-rc2/include/openstudio/utilities/core/Assert.hpp", line=37, function="void boost::assertion_failed(const char*, const char*, const char*, long int)") at assert.c:101:3
  * frame #4: 0x0000555555a0574b OpenStudioApp`boost::assertion_failed(expr="it != m_targetData->reversePointers.end()", function="void openstudio::detail::WorkspaceObject_Impl::nullifyReversePointer(const Handle&, unsigned int)", file="/home/julien/Software/Others/OpenStudio/src/utilities/idf/WorkspaceObject.cpp", line=1024) at Assert.hpp:37:3
    frame #5: 0x00007ffff2d7e0c6 libopenstudiolib.so`openstudio::detail::WorkspaceObject_Impl::nullifyReversePointer(this=0x0000555559e3d540, sourceHandle=0x0000555559e3c448, index=2) at WorkspaceObject.cpp:1024:5
    frame #6: 0x00007ffff2d7dd4b libopenstudiolib.so`openstudio::detail::WorkspaceObject_Impl::nullifyPointer(this=0x0000555559e3c410, index=2) at WorkspaceObject.cpp:1003:68
    frame #7: 0x00007ffff2d7ea94 libopenstudiolib.so`openstudio::detail::WorkspaceObject_Impl::setPointerImpl(this=0x0000555559e3c410, index=2, targetHandle=0x00007fffffff86f0) at WorkspaceObject.cpp:1094:23
    frame #8: 0x00007ffff2d7a585 libopenstudiolib.so`openstudio::detail::WorkspaceObject_Impl::setPointer(this=0x0000555559e3c410, index=2, targetHandle=0x00007fffffff86f0, checkValidity=false) at WorkspaceObject.cpp:522:60
    frame #9: 0x00007ffff2d44922 libopenstudiolib.so`openstudio::detail::Workspace_Impl::nominallyRemoveObject(this=0x0000555559e35ac0, handle=0x0000555558c9c870) at Workspace.cpp:2102:32
    frame #10: 0x00007ffff2d4553f libopenstudiolib.so`openstudio::detail::Workspace_Impl::nominallyRemoveObjects(this=0x0000555559e35ac0, handles=size=12) at Workspace.cpp:2164:46
    frame #11: 0x00007ffff2d34f4a libopenstudiolib.so`openstudio::detail::Workspace_Impl::addClones(this=0x0000555559e35ac0, objectImplPtrs=size=12, oldNewHandleMap=size=9, collectionClone=false, pointersIntoWorkspace=size=0, pointersFromWorkspace=size=0, driverMethod=true) at Workspace.cpp:622:29
    frame #12: 0x00007ffff2d38b2a libopenstudiolib.so`openstudio::detail::Workspace_Impl::addObjects(this=0x0000555559e35ac0, objects=size=12, (null)=false) at Workspace.cpp:949:23
    frame #13: 0x00007ffff2d48b3c libopenstudiolib.so`openstudio::Workspace::addObjects(this=0x00007fffffff9200, objects=size=12, checkNames=false) at Workspace.cpp:2558:48
    frame #14: 0x00007ffff2d39ab3 libopenstudiolib.so`openstudio::detail::Workspace_Impl::addAndInsertObjects(this=0x0000555557f24380, allObjects=size=12, foundObjectIndices=size=2, notFoundObjectIndices=size=9, equivalentObjects=size=2) at Workspace.cpp:1050:75
    frame #15: 0x00007ffff2d397a6 libopenstudiolib.so`openstudio::detail::Workspace_Impl::addAndInsertObjects(this=0x0000555557f24380, objectsToAdd=size=1, objectsToInsert=size=7) at Workspace.cpp:1030:104
    frame #16: 0x00007ffff2d48c94 libopenstudiolib.so`openstudio::Workspace::addAndInsertObjects(this=0x00007fffffff9a80, objectsToAdd=size=1, objectsToInsert=size=7) at Workspace.cpp:2572:67
    frame #17: 0x00007ffff376aead libopenstudiolib.so`openstudio::model::detail::ModelObject_Impl::clone(this=0x00007fffc4358660, model=Model @ 0x00007fffffff9a80) const at ModelObject.cpp:560:41
    frame #18: 0x00007ffff3f280c8 libopenstudiolib.so`openstudio::model::detail::HVACComponent_Impl::clone(this=0x00007fffc4358660, model=Model @ 0x00007fffffff9b00) const at HVACComponent.cpp:403:43
    frame #19: 0x00007ffff399b0d8 libopenstudiolib.so`openstudio::model::detail::AirToAirComponent_Impl::clone(this=0x00007fffc4358660, model=Model @ 0x00007fffffff9bc0) const at AirToAirComponent.cpp:426:42
    frame #20: 0x00007ffff376e0ba libopenstudiolib.so`openstudio::model::ModelObject::clone(this=0x00007fffffff9ca0, model=Model @ 0x00007fffffff9cc0) const at ModelObject.cpp:826:60
    frame #21: 0x00007ffff447b153 libopenstudiolib.so`openstudio::model::detail::ZoneHVACEnergyRecoveryVentilator_Impl::clone(this=0x00007fffc435a190, model=Model @ 0x00007fffffff9d80) const at ZoneHVACEnergyRecoveryVentilator.cpp:83:60
    frame #22: 0x00007ffff376e0ba libopenstudiolib.so`openstudio::model::ModelObject::clone(this=0x00007fffffff9ec8, model=Model @ 0x00007fffffff9e20) const at ModelObject.cpp:826:60

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant