*** glibc detected *** : free(): invalid pointer

Description

When I try to run an extremely simple application created with f8c with the client parameter, I get the core dump below at the end of this post. My main.cpp is very simple as below.

The only thing that might be slightly unusual about my situation is that I am using stunnel so my first few lines of client.xml looks like this:

<?xml version='1.0' encoding='ISO-8859-1'?>
<fix8>
<session name="DLD1"
role="initiator"
fix_version="4400"
no_chksum="true"
active="true"
ip="127.0.0.1"
port="9099"
...

#include <signal.h>

#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <list>
#include <deque>
#include <algorithm> // std::sort
#include <iomanip>
#include <exception> // std::exception

// f8 headers
#include <fix8/f8includes.hpp>
#include <fix8/usage.hpp>
//#include <fix8/consolemenu.hpp>

#include "Myfix_types.hpp"
#include "Myfix_router.hpp"
#include "Myfix_classes.hpp"
#include "Myfix_session.hpp"

using namespace std;
using namespace FIX8;

bool term_received(false);

bool quiet(true);

//-----------------------------------------------------------------------------------------
void sig_handler(int sig)
{
std::cout << "sig_handler" << std::endl;

switch (sig)
{
case SIGTERM:
case SIGINT:
#ifndef _MSC_VER
case SIGQUIT:
#endif
term_received = true;
signal(sig, sig_handler);
break;
}

exit(0);
}
//-----------------------------------------------------------------------------------------
bool Myfix_session_client::handle_application(const unsigned seqnum, const FIX8::Message *&msg)
{
return enforce(seqnum, msg) || msg->process(_router);
}

bool Myfix_session_client::handle_admin(const unsigned seqnum, const FIX8::Message *msg)
{
std::cout << "handle_admin " << std::endl;

return false;
}

bool Myfix_session_client::handle_logon(const unsigned seqnum, const FIX8::Message *msg)
{
std::cout << "handle_logon " << std::endl;

return false;
}

FIX8::Message *Myfix_session_client::generate_logon(const unsigned heartbeat_interval, const f8String davi)
{
std::cout << "generate_logon " << std::endl;
}

// bool handle_logout(const unsigned seqnum, const FIX8::Message *msg);

int main()
{
bool reliable(false);

signal(SIGTERM, sig_handler);
signal(SIGINT, sig_handler);
#ifndef _MSC_VER
signal(SIGQUIT, sig_handler);
#endif

std::cout << "Inside main" << std::endl;

try
{
const string conf_file("client.xml");

FIX8::scoped_ptr<FIX8::ClientSession<Myfix_session_client> >
mc(new FIX8::ClientSession<Myfix_session_client>(FIX8::TEX::ctx(), conf_file, "DLD1"));

mc->start(true);

if (!quiet)
mc->session_ptr()->control() |= FIX8::Session:rint;
}
catch( FIX8::InvalidConfiguration )
{
std::cout << "FIX8::InvalidConfiguration" << std::endl;
}
catch(std::exception& ex)
{
std::cout << "General Exception: " << ex.what() << std::endl;
}

std::cout << "Enter CTRL-C to exit" << std::endl;

}

[idf@localhost Debug]$ ./TestFIX8
Inside main
0000001 A 2014-05-02 14:49:59.853077635 Starting session
0000002 A 2014-05-02 14:49:59.853167471 Trying to connect to: 127.0.0.1:9099 (1) not-secured
0000003 A 2014-05-02 14:49:59.960561649 Connection successful
0000004 A 2014-05-02 14:49:59.960782516 Session connected
generate_logon

  •  

    •  

      • glibc detected *** ./TestFIX8: free(): invalid pointer: 0x00000000008be700 ***
        ======= Backtrace: =========
        /lib64/libc.so.6[0x3097076166]
        /usr/local/lib/libfix8.so.0(_ZN4FIX89FIXWriter7executeERNS_26dthread_cancellation_tokenE+0x6cb)[0x7feb8d76715b]
        ./TestFIX8[0x41d29c]
        ./TestFIX8[0x41e9ce]
        ./TestFIX8(ZN4FIX812_dthreadcore4_runINS_7dthreadINS_11AsyncSocketIPNS_7MessageEEEE7_helperEEEPvS9+0x18)[0x41e5ad]
        /lib64/libpthread.so.0[0x30974079d1]
        /lib64/libc.so.6(clone+0x6d)[0x30970e8b6d]
        ======= Memory map: ========
        00400000-006af000 r-xp 00000000 fd:02 3287601 /home/idf/Documents/fix8projects/TestFIX8/bin/Debug/TestFIX8
        008af000-008bf000 rw-p 002af000 fd:02 3287601 /home/idf/Documents/fix8projects/TestFIX8/bin/Debug/TestFIX8
        008bf000-008e1000 rw-p 00000000 00:00 0
        02392000-02d6f000 rw-p 00000000 00:00 0 [heap]
        3096800000-3096820000 r-xp 00000000 fd:00 37 /lib64/ld-2.12.so
        3096a1f000-3096a20000 r--p 0001f000 fd:00 37 /lib64/ld-2.12.so
        3096a20000-3096a21000 rw-p 00020000 fd:00 37 /lib64/ld-2.12.so
        3096a21000-3096a22000 rw-p 00000000 00:00 0
        3096c00000-3096c02000 r-xp 00000000 fd:00 41 /lib64/libdl-2.12.so
        3096c02000-3096e02000 ---p 00002000 fd:00 41 /lib64/libdl-2.12.so
        3096e02000-3096e03000 r--p 00002000 fd:00 41 /lib64/libdl-2.12.so
        3096e03000-3096e04000 rw-p 00003000 fd:00 41 /lib64/libdl-2.12.so
        3097000000-309718b000 r-xp 00000000 fd:00 38 /lib64/libc-2.12.so
        309718b000-309738a000 ---p 0018b000 fd:00 38 /lib64/libc-2.12.so
        309738a000-309738e000 r--p 0018a000 fd:00 38 /lib64/libc-2.12.so
        309738e000-309738f000 rw-p 0018e000 fd:00 38 /lib64/libc-2.12.so
        309738f000-3097394000 rw-p 00000000 00:00 0
        3097400000-3097417000 r-xp 00000000 fd:00 39 /lib64/libpthread-2.12.so
        3097417000-3097617000 ---p 00017000 fd:00 39 /lib64/libpthread-2.12.so
        3097617000-3097618000 r--p 00017000 fd:00 39 /lib64/libpthread-2.12.so
        3097618000-3097619000 rw-p 00018000 fd:00 39 /lib64/libpthread-2.12.so
        3097619000-309761d000 rw-p 00000000 00:00 0
        3097800000-3097883000 r-xp 00000000 fd:00 59 /lib64/libm-2.12.so
        3097883000-3097a82000 ---p 00083000 fd:00 59 /lib64/libm-2.12.so
        3097a82000-3097a83000 r--p 00082000 fd:00 59 /lib64/libm-2.12.so
        3097a83000-3097a84000 rw-p 00083000 fd:00 59 /lib64/libm-2.12.so
        3097c00000-3097c15000 r-xp 00000000 fd:00 56 /lib64/libz.so.1.2.3
        3097c15000-3097e14000 ---p 00015000 fd:00 56 /lib64/libz.so.1.2.3
        3097e14000-3097e15000 r--p 00014000 fd:00 56 /lib64/libz.so.1.2.3
        3097e15000-3097e16000 rw-p 00015000 fd:00 56 /lib64/libz.so.1.2.3
        3098000000-3098007000 r-xp 00000000 fd:00 40 /lib64/librt-2.12.so
        3098007000-3098206000 ---p 00007000 fd:00 40 /lib64/librt-2.12.so
        3098206000-3098207000 r--p 00006000 fd:00 40 /lib64/librt-2.12.so
        3098207000-3098208000 rw-p 00007000 fd:00 40 /lib64/librt-2.12.so
        30a7600000-30a7607000 r-xp 00000000 fd:00 43 /lib64/libcrypt-2.12.so
        30a7607000-30a7807000 ---p 00007000 fd:00 43 /lib64/libcrypt-2.12.so
        30a7807000-30a7808000 r--p 00007000 fd:00 43 /lib64/libcrypt-2.12.so
        30a7808000-30a7809000 rw-p 00008000 fd:00 43 /lib64/libcrypt-2.12.so
        30a7809000-30a7837000 rw-p 00000000 00:00 0
        7feb7c000000-7feb7c021000 rw-p 00000000 00:00 0
        7feb7c021000-7feb80000000 ---p 00000000 00:00 0
        7feb80000000-7feb80021000 rw-p 00000000 00:00 0
        7feb80021000-7feb84000000 ---p 00000000 00:00 0
        7feb84000000-7feb84021000 rw-p 00000000 00:00 0
        7feb84021000-7feb88000000 ---p 00000000 00:00 0
        7feb8872a000-7feb8872b000 ---p 00000000 00:00 0
        7feb8872b000-7feb8912b000 rw-p 00000000 00:00 0
        7feb8912b000-7feb8912c000 ---p 00000000 00:00 0
        7feb8912c000-7feb89b2c000 rw-p 00000000 00:00 0
        7feb89b2c000-7feb89b2d000 ---p 00000000 00:00 0
        7feb89b2d000-7feb8a52d000 rw-p 00000000 00:00 0
        7feb8a52d000-7feb8a52e000 ---p 00000000 00:00 0
        7feb8a52e000-7feb8af2e000 rw-p 00000000 00:00 0
        7feb8af2e000-7feb8af2f000 ---p 00000000 00:00 0
        7feb8af2f000-7feb8b92f000 rw-p 00000000 00:00 0
        7feb8b92f000-7feb8b930000 ---p 00000000 00:00 0
        7feb8b930000-7feb8c330000 rw-p 00000000 00:00 0
        7feb8c330000-7feb8c331000 ---p 00000000 00:00 0
        7feb8c331000-7feb8cd36000 rw-p 00000000 00:00 0
        7feb8cd36000-7feb8cda7000 r-xp 00000000 fd:00 4714 /lib64/libfreebl3.so
        7feb8cda7000-7feb8cfa6000 ---p 00071000 fd:00 4714 /lib64/libfreebl3.so
        7feb8cfa6000-7feb8cfa8000 r--p 00070000 fd:00 4714 /lib64/libfreebl3.so
        7feb8cfa8000-7feb8cfa9000 rw-p 00072000 fd:00 4714 /lib64/libfreebl3.so
        7feb8cfa9000-7feb8cfae000 rw-p 00000000 00:00 0
        7feb8cfae000-7feb8cfd4000 r-xp 00000000 fd:00 18947 /usr/lib64/libtcmalloc_minimal.so.4.1.0
        7feb8cfd4000-7feb8d1d4000 ---p 00026000 fd:00 18947 /usr/lib64/libtcmalloc_minimal.so.4.1.0
        7feb8d1d4000-7feb8d1d6000 rw-p 00026000 fd:00 18947 /usr/lib64/libtcmalloc_minimal.so.4.1.0
        7feb8d1d6000-7feb8d1fa000 rw-p 00000000 00:00 0
        7feb8d1fa000-7feb8d20f000 r-xp 00000000 fd:00 36330 /lib64/libgcc_s-4.8.2-20131212.so.1
        7feb8d20f000-7feb8d40f000 ---p 00015000 fd:00 36330 /lib64/libgcc_s-4.8.2-20131212.so.1
        7feb8d40f000-7feb8d410000 rw-p 00015000 fd:00 36330 /lib64/libgcc_s-4.8.2-20131212.so.1
        7feb8d410000-7feb8d4fc000 r-xp 00000000 fd:00 5734 /usr/lib64/libstdc++.so.6.0.19
        7feb8d4fc000-7feb8d6fb000 ---p 000ec000 fd:00 5734 /usr/lib64/libstdc++.so.6.0.19
        7feb8d6fb000-7feb8d703000 r--p 000eb000 fd:00 5734 /usr/lib64/libstdc++.so.6.0.19
        7feb8d703000-7feb8d705000 rw-p 000f3000 fd:00 5734 /usr/lib64/libstdc++.so.6.0.19
        7feb8d705000-7feb8d71b000 rw-p 00000000 00:00 0
        7feb8d71b000-7feb8d78c000 r-xp 00000000 fd:00 42 /usr/local/lib/libfix8.so.0.0.0Aborted (core dumped)
        [idf@localhost Debug]$

Environment

Linux CentOS 6.5 x64

Assignee

ivan figueredo

Reporter

ivan figueredo

Labels

None

Branch

master

Products

None

Components

Fix versions

Affects versions

Priority

Major
Configure