sriramn
sriramn

Reputation: 2378

Process terminating with default action of signal 11 [SIGSEGV]

I am building a C++ project in Eclipse. It uses SQLITE3 for database and libxml for reading specific data from a XML file. The code compiles fine and the executable is generated. However when I run the binary it terminates with this message Segmentation fault (core dumped).

When I run the Valgrind profiler to detect where the memory leak is I get this huge log file which I can make no sense of.

    ==4960== Invalid read of size 4
    ==4960==    at 0x41C6EB7: sqlite3SafetyCheckSickOrOk (sqlite3.c:22048)
    ==4960==    by 0x41EADCA: sqlite3_close (sqlite3.c:112926)
    ==4960==    by 0x804A551: Database::close() (CEMDAPnew.cpp:133)
    ==4960==    by 0x805D2F3: CDataCoordinator::ReadVehicleMakeData(std::string) (DataCoordinator.cpp:2709)
    ==4960==    by 0x80689D4: main (GauravWithoutMPI.cpp:36)
    ==4960==  Address 0x4dc1fd0 is 64 bytes inside a block of size 512 free'd
    ==4960==    at 0x402B06C: free (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
    ==4960==    by 0x41B520F: sqlite3MemFree (sqlite3.c:15252)
    ==4960==    by 0x41A2DF0: sqlite3_free (sqlite3.c:18986)
    ==4960==    by 0x41EB0B4: sqlite3_close (sqlite3.c:113040)
    ==4960==    by 0x804A551: Database::close() (CEMDAPnew.cpp:133)
    ==4960==    by 0x805D2F3: CDataCoordinator::ReadVehicleMakeData(std::string) (DataCoordinator.cpp:2709)
    ==4960==    by 0x80689D4: main (GauravWithoutMPI.cpp:36)
    ==4960== 
    ==4960== Conditional jump or move depends on uninitialised value(s)
    ==4960==    at 0x4532DD8: inflateReset2 (in /lib/i386-linux-gnu/libz.so.1.2.3.4)
    ==4960==    by 0x4532EC7: inflateInit2_ (in /lib/i386-linux-gnu/libz.so.1.2.3.4)
    ==4960==    by 0x512FE6B: ???
    ==4960== 
    ==4960== Conditional jump or move depends on uninitialised value(s)
    ==4960==    at 0x4532DD8: inflateReset2 (in /lib/i386-linux-gnu/libz.so.1.2.3.4)
    ==4960==    by 0x4532EC7: inflateInit2_ (in /lib/i386-linux-gnu/libz.so.1.2.3.4)
    ==4960==    by 0x5056E135: ???
    ==4960== 
    ==4960== Invalid read of size 4
    ==4960==    at 0x80BD81C: CMdcevMM::loadXmlString(_xmlNode*, _xmlDoc*, unsigned char*) (ModelModule.cpp:2849)
    ==4960==    by 0x810D73A: CSimCoordinator::LoadXmlString(char const*) (simCoordinator.cpp:8313)
    ==4960==    by 0x8068A4E: main (GauravWithoutMPI.cpp:45)
    ==4960==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
    ==4960== 
    ==4960== 
    ==4960== Process terminating with default action of signal 11 (SIGSEGV)

I need to make sense of this output. Can anyone help me make sense of this error and what is the issue here?

Thanks.

Upvotes: 1

Views: 27317

Answers (1)

ks1322
ks1322

Reputation: 35716

First of all you should start fixing Invalid read errors. They are the most likely reason of Segmentation fault, which has nothing to do with memory leaks.

The first Invalid read in Valgrind output means that sqlite3SafetyCheckSickOrOk call referred to some memory already freed previously. The exact call stack where it happened is printed below. This looks strange because it happened in sqlite3_close which than refers to freed memory. Probably this is sqlite bug.

The second Invalid read means referring to NULL pointer in CMdcevMM::loadXmlString. Check your code.

Upvotes: 2

Related Questions