CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

corrupted double-linked list error when linking certain libraries

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 26, 2013, 07:47
Default corrupted double-linked list error when linking certain libraries
  #1
Senior Member
 
Robert Sawko
Join Date: Mar 2009
Posts: 117
Rep Power: 22
AlmostSurelyRob will become famous soon enough
I encountered recently a very strange problem when linking one of my libraries to a variation of multiphaseEulerFoam. I have found already two work-arounds, but I do not understand fully what is happening and my feeling is that there's a bug somewhere either on my side or in multiphaseSystem library. If any one of you came across this please let me know.


I am linking a new library to STFMultiphaseEulerFoam which is a simple modification of multiphaseEulerFoam. The library has some run time selectibility through standard set of macros. On exit the application freezes and gives me this error

Code:
*** Error in `STFMultiphaseEulerFoam': corrupted double-linked list: 0x0000000001572a90 ***
This does not happen when I link the same library to a different solver (e.g. interFoam). Also it does not happen on intel compilers and it does not happen if I do not link shared libraries to my library but postpone linking until I compile the solver (workaround 1).

When I run this through valgrind I get this

Code:
==27221== Memcheck, a memory error detector
==27221== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==27221== Using Valgrind-3.9.0 and LibVEX; rerun with -h for copyright info
==27221== Command: STFMultiphaseEulerFoam
==27221== 


--> FOAM FATAL IO ERROR: 
cannot find file

file: /home/c111269/projects/STFFoam.git/build/system/controlDict at line 0.

    From function regIOobject::readStream()
    in file db/regIOobject/regIOobjectRead.C at line 73.

FOAM exiting

==27221== Invalid read of size 4
==27221==    at 0x4E5C8E2: Foam::word::~word() (in /home/c111269/OpenFOAM/OpenFOAM-2.2.x/platforms/linux64GccDPOpt/lib/libmultiphaseSystem.so)
==27221==    by 0x8CD322E: __cxa_finalize (in /usr/lib/libc-2.18.so)
==27221==    by 0x825C162: ??? (in /home/c111269/OpenFOAM/OpenFOAM-2.2.x/platforms/linux64GccDPOpt/lib/libtwoPhaseProperties.so)
==27221==    by 0x400EEF9: _dl_fini (in /usr/lib/ld-2.18.so)
==27221==    by 0x8CD2EA8: __run_exit_handlers (in /usr/lib/libc-2.18.so)
==27221==    by 0x8CD2EF4: exit (in /usr/lib/libc-2.18.so)
==27221==    by 0x773BBBA: Foam::IOerror::exit(int) (in /home/c111269/OpenFOAM/OpenFOAM-2.2.x/platforms/linux64GccDPOpt/lib/libOpenFOAM.so)
==27221==    by 0x77F9F74: Foam::regIOobject::readStream() (in /home/c111269/OpenFOAM/OpenFOAM-2.2.x/platforms/linux64GccDPOpt/lib/libOpenFOAM.so)
==27221==    by 0x77FA2F7: Foam::regIOobject::readStream(Foam::word const&) (in /home/c111269/OpenFOAM/OpenFOAM-2.2.x/platforms/linux64GccDPOpt/lib/libOpenFOAM.so)
==27221==    by 0x77F4F13: Foam::IOdictionary::readFile(bool) (in /home/c111269/OpenFOAM/OpenFOAM-2.2.x/platforms/linux64GccDPOpt/lib/libOpenFOAM.so)
==27221==    by 0x77F46FB: Foam::IOdictionary::IOdictionary(Foam::IOobject const&) (in /home/c111269/OpenFOAM/OpenFOAM-2.2.x/platforms/linux64GccDPOpt/lib/libOpenFOAM.so)
==27221==    by 0x781C5A2: Foam::Time::Time(Foam::word const&, Foam::argList const&, Foam::word const&, Foam::word const&) (in /home/c111269/OpenFOAM/OpenFOAM-2.2.x/platforms/linux64GccDPOpt/lib/libOpenFOAM.so)
==27221==  Address 0xbc15210 is 16 bytes inside a block of size 42 free'd
==27221==    at 0x4C28EAC: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==27221==    by 0x4E5C8F7: Foam::word::~word() (in /home/c111269/OpenFOAM/OpenFOAM-2.2.x/platforms/linux64GccDPOpt/lib/libmultiphaseSystem.so)
==27221==    by 0x8CD322E: __cxa_finalize (in /usr/lib/libc-2.18.so)
==27221==    by 0x4E5A602: ??? (in /home/c111269/OpenFOAM/OpenFOAM-2.2.x/platforms/linux64GccDPOpt/lib/libmultiphaseSystem.so)
==27221==    by 0x400EEF9: _dl_fini (in /usr/lib/ld-2.18.so)
==27221==    by 0x8CD2EA8: __run_exit_handlers (in /usr/lib/libc-2.18.so)
==27221==    by 0x8CD2EF4: exit (in /usr/lib/libc-2.18.so)
==27221==    by 0x773BBBA: Foam::IOerror::exit(int) (in /home/c111269/OpenFOAM/OpenFOAM-2.2.x/platforms/linux64GccDPOpt/lib/libOpenFOAM.so)
==27221==    by 0x77F9F74: Foam::regIOobject::readStream() (in /home/c111269/OpenFOAM/OpenFOAM-2.2.x/platforms/linux64GccDPOpt/lib/libOpenFOAM.so)
==27221==    by 0x77FA2F7: Foam::regIOobject::readStream(Foam::word const&) (in /home/c111269/OpenFOAM/OpenFOAM-2.2.x/platforms/linux64GccDPOpt/lib/libOpenFOAM.so)
==27221==    by 0x77F4F13: Foam::IOdictionary::readFile(bool) (in /home/c111269/OpenFOAM/OpenFOAM-2.2.x/platforms/linux64GccDPOpt/lib/libOpenFOAM.so)
==27221==    by 0x77F46FB: Foam::IOdictionary::IOdictionary(Foam::IOobject const&) (in /home/c111269/OpenFOAM/OpenFOAM-2.2.x/platforms/linux64GccDPOpt/lib/libOpenFOAM.so)
==27221== 
==27221== Invalid free() / delete / delete[] / realloc()
==27221==    at 0x4C28EAC: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==27221==    by 0x4E5C8F7: Foam::word::~word() (in /home/c111269/OpenFOAM/OpenFOAM-2.2.x/platforms/linux64GccDPOpt/lib/libmultiphaseSystem.so)
==27221==    by 0x8CD322E: __cxa_finalize (in /usr/lib/libc-2.18.so)
==27221==    by 0x825C162: ??? (in /home/c111269/OpenFOAM/OpenFOAM-2.2.x/platforms/linux64GccDPOpt/lib/libtwoPhaseProperties.so)
==27221==    by 0x400EEF9: _dl_fini (in /usr/lib/ld-2.18.so)
==27221==    by 0x8CD2EA8: __run_exit_handlers (in /usr/lib/libc-2.18.so)
==27221==    by 0x8CD2EF4: exit (in /usr/lib/libc-2.18.so)
==27221==    by 0x773BBBA: Foam::IOerror::exit(int) (in /home/c111269/OpenFOAM/OpenFOAM-2.2.x/platforms/linux64GccDPOpt/lib/libOpenFOAM.so)
==27221==    by 0x77F9F74: Foam::regIOobject::readStream() (in /home/c111269/OpenFOAM/OpenFOAM-2.2.x/platforms/linux64GccDPOpt/lib/libOpenFOAM.so)
==27221==    by 0x77FA2F7: Foam::regIOobject::readStream(Foam::word const&) (in /home/c111269/OpenFOAM/OpenFOAM-2.2.x/platforms/linux64GccDPOpt/lib/libOpenFOAM.so)
==27221==    by 0x77F4F13: Foam::IOdictionary::readFile(bool) (in /home/c111269/OpenFOAM/OpenFOAM-2.2.x/platforms/linux64GccDPOpt/lib/libOpenFOAM.so)
==27221==    by 0x77F46FB: Foam::IOdictionary::IOdictionary(Foam::IOobject const&) (in /home/c111269/OpenFOAM/OpenFOAM-2.2.x/platforms/linux64GccDPOpt/lib/libOpenFOAM.so)
==27221==  Address 0xbc15200 is 0 bytes inside a block of size 42 free'd
==27221==    at 0x4C28EAC: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==27221==    by 0x4E5C8F7: Foam::word::~word() (in /home/c111269/OpenFOAM/OpenFOAM-2.2.x/platforms/linux64GccDPOpt/lib/libmultiphaseSystem.so)
==27221==    by 0x8CD322E: __cxa_finalize (in /usr/lib/libc-2.18.so)
==27221==    by 0x4E5A602: ??? (in /home/c111269/OpenFOAM/OpenFOAM-2.2.x/platforms/linux64GccDPOpt/lib/libmultiphaseSystem.so)
==27221==    by 0x400EEF9: _dl_fini (in /usr/lib/ld-2.18.so)
==27221==    by 0x8CD2EA8: __run_exit_handlers (in /usr/lib/libc-2.18.so)
==27221==    by 0x8CD2EF4: exit (in /usr/lib/libc-2.18.so)
==27221==    by 0x773BBBA: Foam::IOerror::exit(int) (in /home/c111269/OpenFOAM/OpenFOAM-2.2.x/platforms/linux64GccDPOpt/lib/libOpenFOAM.so)
==27221==    by 0x77F9F74: Foam::regIOobject::readStream() (in /home/c111269/OpenFOAM/OpenFOAM-2.2.x/platforms/linux64GccDPOpt/lib/libOpenFOAM.so)
==27221==    by 0x77FA2F7: Foam::regIOobject::readStream(Foam::word const&) (in /home/c111269/OpenFOAM/OpenFOAM-2.2.x/platforms/linux64GccDPOpt/lib/libOpenFOAM.so)
==27221==    by 0x77F4F13: Foam::IOdictionary::readFile(bool) (in /home/c111269/OpenFOAM/OpenFOAM-2.2.x/platforms/linux64GccDPOpt/lib/libOpenFOAM.so)
==27221==    by 0x77F46FB: Foam::IOdictionary::IOdictionary(Foam::IOobject const&) (in /home/c111269/OpenFOAM/OpenFOAM-2.2.x/platforms/linux64GccDPOpt/lib/libOpenFOAM.so)
==27221== 
==27221== 
==27221== HEAP SUMMARY:
==27221==     in use at exit: 2,540 bytes in 15 blocks
==27221==   total heap usage: 33,073 allocs, 33,059 frees, 3,293,055 bytes allocated
//some output removed
==27221== 
==27221== 42 bytes in 1 blocks are definitely lost in loss record 9 of 15
==27221==    at 0x4C27CC2: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==27221==    by 0x85384F8: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (in /usr/lib/libstdc++.so.6.0.18)
==27221==    by 0x8539C30: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag) (in /usr/lib/libstdc++.so.6.0.18)
==27221==    by 0x853A047: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (in /usr/lib/libstdc++.so.6.0.18)
==27221==    by 0x825ADFF: _GLOBAL__sub_I_alphaContactAngleFvPatchScalarField.C (in /home/c111269/OpenFOAM/OpenFOAM-2.2.x/platforms/linux64GccDPOpt/lib/libtwoPhaseProperties.so)
==27221==    by 0x400E8E9: call_init.part.0 (in /usr/lib/ld-2.18.so)
==27221==    by 0x400E9D2: _dl_init (in /usr/lib/ld-2.18.so)
==27221==    by 0x40012A9: ??? (in /usr/lib/ld-2.18.so)
// some output removed
==27221== 
==27221== LEAK SUMMARY:
==27221==    definitely lost: 42 bytes in 1 blocks
==27221==    indirectly lost: 0 bytes in 0 blocks
==27221==      possibly lost: 442 bytes in 11 blocks
==27221==    still reachable: 2,056 bytes in 3 blocks
==27221==         suppressed: 0 bytes in 0 blocks
==27221== Reachable blocks (those to which a pointer was found) are not shown.
==27221== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==27221== 
==27221== For counts of detected and suppressed errors, rerun with: -v
==27221== ERROR SUMMARY: 16 errors from 14 contexts (suppressed: 2 from 2)
I removed "possibly lost" output. Please note the invalid free and that there's some data "definitely lost" and it is in _GLOBAL__sub_I_alphaContactAngleFvPatchScalarField .C. Following this I removed the corresponding C file and recompiled multiphaseSystem library, which caused the error to go away too (workaround 2).

note also that wmake when creating a shared object doesn't link. The only reason why I spotted this was due to cmake. I moved the compilation of my project to cmake and was doing linking when creating so too. As far as I understand this should not matter. If you have any suggestions please advise.
AlmostSurelyRob is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Continuing User Defined Real Gas Model issues aeroman FLUENT 6 April 8, 2016 04:34
Parallel User Defined Real Gas Model aeroman FLUENT 4 July 1, 2015 07:09
Missing math.h header Travis FLUENT 4 January 15, 2009 12:48
DecomposePar links against liblamso0 with OpenMPI jens_klostermann OpenFOAM Bugs 11 June 28, 2007 18:51
REAL GAS UDF brian FLUENT 6 September 11, 2006 09:23


All times are GMT -4. The time now is 08:03.