Question to Jonathan about the decRef

Help
2013-12-27
2013-12-28
  • ama.telular

    ama.telular - 2013-12-27

    Hi Jonathan,

    I've got libJson up and running on a ARM based platform under augstram linux distribution.

    I have a very inconsist issue with following stack output;

    The stack after crash is as followed,
    ~~~~~~~~~~~~~~~~~stack~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    (gdb) bt

    0 0x00010fdc in internalJSONNode::decRef (this=0x1)

    at _internal/Source/internalJSONNode.h:379
    

    1 0x000111d8 in JSONNode::decRef (this=0x1d0618)

    at _internal/Source/JSONNode.h:821
    

    2 0x00011168 in JSONNode::~JSONNode (this=0x1d0618,

    __in_chrg=<optimized out>) at _internal/Source/JSONNode.h:612
    

    3 0x0010c284 in JSONNode::deleteJSONNode (ptr=0x1d0618) at JSONNode.cpp:311

    4 0x00106d88 in jsonChildren::deleteAll (this=0x1d0168)

    at JSONChildren.cpp:76
    

    5 0x0011cbac in jsonChildren::~jsonChildren (this=0x1d0168,

    __in_chrg=<optimized out>) at JSONChildren.h:54
    

    6 0x0011cc58 in jsonChildren::deleteChildren (ptr=0x1d0168)

    at JSONChildren.h:256
    

    7 0x00119cc8 in internalJSONNode::~internalJSONNode (this=0x1d0130,

    __in_chrg=<optimized out>) at internalJSONNode.cpp:155
    

    8 0x0011bc0c in internalJSONNode::deleteInternal (ptr=0x1d0130)

    at internalJSONNode.cpp:677
    

    9 0x00011204 in JSONNode::decRef (this=0x1d0670)

    at _internal/Source/JSONNode.h:823
    

    10 0x00011168 in JSONNode::~JSONNode (this=0x1d0670,

    __in_chrg=<optimized out>) at _internal/Source/JSONNode.h:612
    

    11 0x0010c284 in JSONNode::deleteJSONNode (ptr=0x1d0670) at JSONNode.cpp:311

    12 0x00106d88 in jsonChildren::deleteAll (this=0x1c4238)

    at JSONChildren.cpp:76
    

    13 0x0011cbac in jsonChildren::~jsonChildren (this=0x1c4238,

    __in_chrg=<optimized out>) at JSONChildren.h:54
    

    14 0x0011cc58 in jsonChildren::deleteChildren (ptr=0x1c4238)

    at JSONChildren.h:256
    

    15 0x00119cc8 in internalJSONNode::~internalJSONNode (this=0x1d4988,

    __in_chrg=<optimized out>) at internalJSONNode.cpp:155
    

    16 0x0011bc0c in internalJSONNode::deleteInternal (ptr=0x1d4988)

    at internalJSONNode.cpp:677
    

    17 0x00011204 in JSONNode::decRef (this=0x473a017c)

    at _internal/Source/JSONNode.h:823
    

    18 0x00011168 in JSONNode::~JSONNode (this=0x473a017c,

    __in_chrg=<optimized out>) at _internal/Source/JSONNode.h:612
    

    19 0x0001e420 in CCommService::Store_Port_Config2DataBase (this=0x153668,

    strModuleId=...) at CommService.cpp:1245
    

    20 0x000a9b8c in CCommService::RequestReply (arg=0x0) at CommService.cpp:12196

    ~~~~~~~~~~~~~~~~~stack~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    what is wrong with my libjson library? How could I solve this issue?

    ~~~~~~~~~~~~~~~~~code~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    at the member function CCommService::Store_Port_Config2DataBase (this=0x153668,
    strModuleId=...) at CommService.cpp:1245

    line 1245 is the end of function.

    ~~~~~~~~~~~~~~~~~code~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

     
  • ama.telular

    ama.telular - 2013-12-28

    Hey Jonathan,

    Are you available to answer this question?
    I give the source to help me spot wrong-doing.

    void CCommService::Store_Port_Config2DataBase(std::string strModuleId)
    {

    boost::unordered_multimap<std::string ,struct stHardWareConfig>::iterator itrPortConf;
    JSONNode jvContent(JSON_ARRAY);
    for (itrPortConf = m_ptrCommService->m_multimapDataPnt2PortConfig.begin();itrPortConf!= m_ptrCommService->m_multimapDataPnt2PortConfig.end();itrPortConf++)//ama add static pointer
    {
        if(strModuleId == itrPortConf->second.m_strModuleId)
        {
            JSONNode jvPortConfMsg(JSON_NODE);//ama, initialization
    
            if(itrPortConf->second.m_strPort_Type == AI_NAME)
            {
                .........
            }
            if(itrPortConf->second.m_strPort_Type == PI_NAME)
            {
                .........           }
            if(itrPortConf->second.m_strPort_Type == AO_NAME)
            {
                ....................            }
            if(itrPortConf->second.m_strPort_Type == DI_NAME)
            {
                jvPortConfMsg.push_back(JSONNode(DATAPOINT_UUID,itrPortConf->second.m_strDataPoint));
                jvPortConfMsg.push_back(JSONNode(PORT_ENABLED,itrPortConf->second.m_bPortEnabled));
                jvPortConfMsg.push_back(JSONNode(PORT_CONFIGURED,itrPortConf->second.m_bPortConfigured));
                DEBUG1("itrPortConf->second.m_PortConfig.ptrDIPortConfig->m_strUserDefinedName is %s \n",itrPortConf->second.m_PortConfig.ptrDIPortConfig->m_strUserDefinedName.c_str());
                jvPortConfMsg.push_back(JSONNode(USER_DEFINED_NAME,itrPortConf->second.m_PortConfig.ptrDIPortConfig->m_strUserDefinedName));
                jvPortConfMsg.push_back(JSONNode(PORTTYPE_NAME,itrPortConf->second.m_strPort_Type));
            }
            if(itrPortConf->second.m_strPort_Type == DO_NAME)
            {
                jvPortConfMsg.push_back(JSONNode(DATAPOINT_UUID,itrPortConf->second.m_strDataPoint));
                jvPortConfMsg.push_back(JSONNode(PORT_ENABLED,itrPortConf->second.m_bPortEnabled));
                jvPortConfMsg.push_back(JSONNode(PORT_CONFIGURED,itrPortConf->second.m_bPortConfigured));
                jvPortConfMsg.push_back(JSONNode(USER_DEFINED_NAME,itrPortConf->second.m_PortConfig.ptrDOPortConfig->m_strUserDefinedName));
                jvPortConfMsg.push_back(JSONNode(PORTTYPE_NAME,itrPortConf->second.m_strPort_Type));
            }
            if(itrPortConf->second.m_strPort_Type == TI_NAME)
            {
                            ...........................
            }
            if(itrPortConf->second.m_strPort_Type == ACCI_NAME)
            {
                .......................         }
                        if(itrPortConf->second.m_strPort_Type == TURBINE_NAME)
                        {
                                .....................                        }
            if(itrPortConf->second.m_strPort_Type == LI_NAME)
            {
                jvPortConfMsg.push_back(JSONNode(DATAPOINT_UUID,itrPortConf->second.m_strDataPoint));
                jvPortConfMsg.push_back(JSONNode(PORT_ENABLED,itrPortConf->second.m_bPortEnabled));
                jvPortConfMsg.push_back(JSONNode(PORT_CONFIGURED,itrPortConf->second.m_bPortConfigured));
                jvPortConfMsg.push_back(JSONNode(USER_DEFINED_NAME,itrPortConf->second.m_PortConfig.ptrLIPortConfig->m_strUserDefinedName));
                jvPortConfMsg.push_back(JSONNode(PORTTYPE_NAME,itrPortConf->second.m_strPort_Type));
                jvPortConfMsg.push_back(JSONNode(RPC_MODE,itrPortConf->second.m_PortConfig.ptrLIPortConfig->m_strRPCMode));
                jvPortConfMsg.push_back(JSONNode(RATE_NAME,itrPortConf->second.m_PortConfig.ptrLIPortConfig->m_fRate));
                jvPortConfMsg.push_back(JSONNode(GAIN_NAME,itrPortConf->second.m_PortConfig.ptrLIPortConfig->m_fGain));
                jvPortConfMsg.push_back(JSONNode(BIPOLAR_NAME,itrPortConf->second.m_PortConfig.ptrLIPortConfig->m_bBipolar));
            }
            if(itrPortConf->second.m_strPort_Type == RS485_NAME)
            {
                ...............
                        }
            jvContent.push_back(jvPortConfMsg);
        }
    }
    JSONNode jvMethod(JSON_NODE);
    JSONNode jvVersion(JSON_NODE);
    JSONNode jvParams(JSON_NODE);
    jvMethod.push_back(JSONNode(METHOD_NAME,ADD_PORT_CONFIGURATION));
    jvParams.set_name( PARAMS_NAME );
    jvParams.push_back(JSONNode(MODULE_UUID_NAME,strModuleId));
    jvParams.push_back(JSONNode(DOC_OWNER,EMC_NAME));
    jvContent.set_name(PORT_CONFIGURATIONS);
    jvParams.push_back(jvContent);
    jvVersion.set_name(VERSION_NAME);
    jvVersion.push_back(JSONNode(MAJOR_NAME,1));
    jvVersion.push_back(JSONNode(MINOR_NAME,0));
    jvMethod.push_back(jvVersion);
    jvMethod.push_back(jvParams);
    std::string strPortConfig=jvMethod.write();
    strPortConfig = strPortConfig + '\0';
    DEBUG1("Add Port Configuration To DATABASE:%s",strPortConfig.c_str());
    zmq_msg_t zmqPortConfig, zmqRspMsg;
    zmq_msg_init_size (&zmqPortConfig, strPortConfig.size());
    zmq_msg_init(&zmqRspMsg);
    memcpy (zmq_msg_data(&zmqPortConfig), strPortConfig.c_str(), strPortConfig.size());
    
    DEBUG1( "DAL Request - %s", strPortConfig.c_str() );
    
    zmq_send_wrapper(m_ptrCommService->zmqDALSocket, &zmqPortConfig, 0);
    zmq_recv_wrapper(m_ptrCommService->zmqDALSocket, &zmqRspMsg, 0);
    zmq_msg_close (&zmqPortConfig);
    zmq_msg_close (&zmqRspMsg);
    

    }

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks