ORNL-CEES / thermochimica

Computational library for chemical thermodynamics and phase equilibrium calculation. Multiphysics and standalone estimations of chemical state and constitutive and transport properties.
BSD 3-Clause "New" or "Revised" License
43 stars 25 forks source link

Invalid memory writes #148

Closed parikshitbajpai closed 11 months ago

parikshitbajpai commented 11 months ago

There are several invalid memory writes in subroutines dependent on memory allocations in LevelingSolvers.f90. These can lead to crashes down the line.

==70898== Invalid write of size 8
==70898==    at 0xD825C0D: getfirstassemblage_ (GetFirstAssemblage.f90:96)
==70898==    by 0xD80C348: levelingsolver_ (LevelingSolver.f90:188)
==70898==    by 0xD7C2FE8: thermochimicasolver_ (Thermochimica.f90:457)
==70898==    by 0xD7AE47D: Thermochimica::thermochimica() (Thermochimica-cxx.C:15)
==70898==    by 0x533DEBD: ThermochimicaNodalData::execute() (ThermochimicaNodalData.C:168)
==70898==    by 0xA019048: ComputeNodalUserObjectsThread::onNode(__gnu_cxx::__normal_iterator<libMesh::Node const* const*, std::vector<libMesh::Node const*, std::allocator<libMesh::Node const*> > >&) (ComputeNodalUserObjectsThread.C:119)
==70898==    by 0xA065001: ThreadedNodeLoop<libMesh::StoredRange<libMesh::MeshBase::const_node_iterator, libMesh::Node const*>, __gnu_cxx::__normal_iterator<libMesh::Node const* const*, std::vector<libMesh::Node const*, std::allocator<libMesh::Node const*> > > >::operator()(libMesh::StoredRange<libMesh::MeshBase::const_node_iterator, libMesh::Node const*> const&) (ThreadedNodeLoop.h:109)
==70898==    by 0xB0D36E7: void libMesh::Threads::parallel_reduce<libMesh::StoredRange<libMesh::MeshBase::const_node_iterator, libMesh::Node const*>, ComputeNodalUserObjectsThread>(libMesh::StoredRange<libMesh::MeshBase::const_node_iterator, libMesh::Node const*> const&, ComputeNodalUserObjectsThread&) (threads_pthread.h:380)
==70898==    by 0xB073A19: FEProblemBase::computeUserObjectsInternal(MooseEnumItem const&, Moose::AuxGroup const&, TheWarehouse::QueryCache<>&) (FEProblemBase.C:4261)
==70898==    by 0xB071A73: FEProblemBase::computeUserObjects(MooseEnumItem const&, Moose::AuxGroup const&) (FEProblemBase.C:4135)
==70898==    by 0xB070A0A: FEProblemBase::execute(MooseEnumItem const&) (FEProblemBase.C:3983)
==70898==    by 0xB04DCC4: FEProblemBase::initialSetup() (FEProblemBase.C:1134)
==70898==  Address 0x1b282a90 is 0 bytes after a block of size 16 alloc'd
==70898==    at 0x4C29F73: malloc (vg_replace_malloc.c:307)
==70898==    by 0xD80CBB5: levelingsolver_ (LevelingSolver.f90:164)
==70898==    by 0xD7C2FE8: thermochimicasolver_ (Thermochimica.f90:457)
==70898==    by 0xD7AE47D: Thermochimica::thermochimica() (Thermochimica-cxx.C:15)
==70898==    by 0x533DEBD: ThermochimicaNodalData::execute() (ThermochimicaNodalData.C:168)
==70898==    by 0xA019048: ComputeNodalUserObjectsThread::onNode(__gnu_cxx::__normal_iterator<libMesh::Node const* const*, std::vector<libMesh::Node const*, std::allocator<libMesh::Node const*> > >&) (ComputeNodalUserObjectsThread.C:119)
==70898==    by 0xA065001: ThreadedNodeLoop<libMesh::StoredRange<libMesh::MeshBase::const_node_iterator, libMesh::Node const*>, __gnu_cxx::__normal_iterator<libMesh::Node const* const*, std::vector<libMesh::Node const*, std::allocator<libMesh::Node const*> > > >::operator()(libMesh::StoredRange<libMesh::MeshBase::const_node_iterator, libMesh::Node const*> const&) (ThreadedNodeLoop.h:109)
==70898==    by 0xB0D36E7: void libMesh::Threads::parallel_reduce<libMesh::StoredRange<libMesh::MeshBase::const_node_iterator, libMesh::Node const*>, ComputeNodalUserObjectsThread>(libMesh::StoredRange<libMesh::MeshBase::const_node_iterator, libMesh::Node const*> const&, ComputeNodalUserObjectsThread&) (threads_pthread.h:380)
==70898==    by 0xB073A19: FEProblemBase::computeUserObjectsInternal(MooseEnumItem const&, Moose::AuxGroup const&, TheWarehouse::QueryCache<>&) (FEProblemBase.C:4261)
==70898==    by 0xB071A73: FEProblemBase::computeUserObjects(MooseEnumItem const&, Moose::AuxGroup const&) (FEProblemBase.C:4135)
==70898==    by 0xB070A0A: FEProblemBase::execute(MooseEnumItem const&) (FEProblemBase.C:3983)
==70898==    by 0xB04DCC4: FEProblemBase::initialSetup() (FEProblemBase.C:1134)

A full list of Valgrind errors are in this file