The server application always crashes at the same line in code. I used gdb and valgrind to find the problem, but it seems the crash point is in a compiler created destructor, and this is what valgrind says:
==27785== Invalid read of size 8
==27785== at 0x5CDCE25: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string() (in /usr/lib64/libstdc++.so.6.0.8)
==27785== by 0x5812F4: Pet::BookConfiguration::~BookConfiguration() (BookConfiguration.h:8)
==27785== by 0x5EDEC4: void std::_Destroy<Pet::BookConfiguration>(Pet::BookConfiguration*) (stl_construct.h:107)
==27785== by 0x5EDEE2: void std::__destroy_aux<Pet::BookConfiguration*>(Pet::BookConfiguration*, Pet::BookConfiguration*, __false_type) (stl_construct.h:12
2)
==27785== by 0x5EDF17: void std::_Destroy<Pet::BookConfiguration*>(Pet::BookConfiguration*, Pet::BookConfiguration*) (stl_construct.h:155)
==27785== by 0x5EDF3A: void std::_Destroy<Pet::BookConfiguration*, Pet::BookConfiguration>(Pet::BookConfiguration*, Pet::BookConfiguration*, std::allocator
<Pet::BookConfiguration>) (stl_construct.h:182)
==27785== by 0x5F5C09: std::vector<Pet::BookConfiguration, std::allocator<Pet::BookConfiguration> >::~vector() (stl_vector.h:272)
==27785== by 0x5F6A22: Pet::ShopModel::~ShopModel() (ShopModel.h:15)
==27785== by 0x5C59E3: Pet::PetProcessor::climbFight(Pet::SourceList&, Pet::TBuffer&) (PetProcessor.cpp:1796)
==27785== by 0x589263: Pet::Processor::execute(Pet::SourceList&, unsigned short, Pet::TBuffer&) (Processor.cpp:22)
==27785== by 0x578627: Pet::JobThread<Pet::PetProcessor>::run() (JobThread.h:66)
==27785== by 0x4F81AB2: Poco::PooledThread::run() (in /data/home/app100619699/pet_srv/lib/libPocoFoundation.so.11)
==27785== Address 0x900df30 is 7 bytes after a block of size 57 free'd
==27785== at 0x4A201B6: operator delete(void*) (vg_replace_malloc.c:457)
==27785== by 0x5CDCE59: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string() (in /usr/lib64/libstdc++.so.6.0.8)
==27785== by 0x5CFFE6: Pet::PetProcessor::getUserBag(Pet::SourceList&, Pet::TBuffer&) (PetProcessor.cpp:446)
==27785== by 0x589263: Pet::Processor::execute(Pet::SourceList&, unsigned short, Pet::TBuffer&) (Processor.cpp:22)
==27785== by 0x578627: Pet::JobThread<Pet::PetProcessor>::run() (JobThread.h:66)
==27785== by 0x4F81AB2: Poco::PooledThread::run() (in /data/home/app100619699/pet_srv/lib/libPocoFoundation.so.11)
==27785== by 0x4F7D1D5: Poco::ThreadImpl::runnableEntry(void*) (in /data/home/app100619699/pet_srv/lib/libPocoFoundation.so.11)
==27785== by 0x54DE192: start_thread (in /lib64/libpthread-2.4.so)
==27785== by 0x6161F0C: clone (in /lib64/libc-2.4.so)
The two string mentioned here have no relationship, and they are all local variables. Who can tell me why it happens or how can I find the real crash problem?
Pet::BookConfiguration::~BookConfiguration()
is a compiler created destructor. It need not do anything because this class have no resource to release.