Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • openfoam openfoam
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 426
    • Issues 426
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 8
    • Merge requests 8
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Development
  • openfoamopenfoam
  • Issues
  • #2269
Closed
Open
Issue created Nov 12, 2021 by Jan Gärtner@janga

segFault on clean up of fvMesh with particle clouds

Summary

Introducing basicKinematicCloud objects cause segmentation fault at end of simulation

Steps to reproduce

Add a kinematic cloud to any solver e.g.:

wordList cloudNames("myCloud");

// Create an empty pointer list for all particle clouds
PtrList<basicKinematicCloud> clouds(cloudNames.size());

Info << "Solving with particle clouds"<<cloudNames<<endl;
for (int i=0; i < cloudNames.size(); i++)
    clouds.set
    (
        i,
        new basicKinematicCloud
        (
            cloudNames[i],      // Name of the particle cloud
            rho2,               // Density of the gas 
            U,                  // Common velocity
            thermo2.mu(),       // Gas viscosity
            g                   // Gravity if required
        )
    );

Then after the statement Info<< "End\n" << endl; a segmentation fault is thrown.

Investigation with GDB

When the program is run with '-g' flag in gdb the stack trace shows:

#0  0x0000555582cac0e0 in ?? ()
#1  0x00007fffefd97f6d in Foam::dictionary::~dictionary() () from /home/itvjg/OpenFOAM/OpenFOAM-v2012-int64/platforms/linux64GccDPInt64Opt/lib/libOpenFOAM.so
#2  0x00007fffefdc5c4b in Foam::IOdictionary::~IOdictionary() () from /home/itvjg/OpenFOAM/OpenFOAM-v2012-int64/platforms/linux64GccDPInt64Opt/lib/libOpenFOAM.so
#3  0x00007ffff39f2091 in Foam::fvMesh::~fvMesh() () from /home/itvjg/OpenFOAM/OpenFOAM-v2012-int64/platforms/linux64GccDPInt64Opt/lib/libfiniteVolume.so
#4  0x00007ffff39f2169 in Foam::fvMesh::~fvMesh() () from /home/itvjg/OpenFOAM/OpenFOAM-v2012-int64/platforms/linux64GccDPInt64Opt/lib/libfiniteVolume.so
#5  0x00005555555a6b9b in Foam::autoPtr<Foam::fvMesh>::reset (p=0x0, this=0x7fffffff79e8) at /home/itvjg/OpenFOAM/OpenFOAM-v2012-int64/src/OpenFOAM/lnInclude/autoPtrI.H:111
#6  Foam::autoPtr<Foam::fvMesh>::~autoPtr (this=0x7fffffff79e8, __in_chrg=<optimized out>) at /home/itvjg/OpenFOAM/OpenFOAM-v2012-int64/src/OpenFOAM/lnInclude/autoPtrI.H:93
#7  main (argc=<optimized out>, argv=<optimized out>) at /home/itvjg/OpenFOAM/OpenFOAM-v2012-int64/src/OpenFOAM/lnInclude/createMesh.H:1

Stepping through the program shows that the problem is caused when the reset function of the Foam::autoPtr<Foam::fvMesh>::reset() is called and it attempts to delete the pointer p_.

This behavior also occurs if the KinematicCloud is stored in a simple List as a pointer.

Assignee
Assign to
Time tracking