Dear all,

I created an application that would iterate a checkpoint and read all sections. 
The checkpoint may be inserted or deleted sections at the same time by another 
application. Occasionally the ckptnd daemon will crash. Please see core file 
back trace, and my functions to iteration all sections as below:

-----------------------BT------------
Program terminated with signal 11, Segmentation fault.
#0  0x000000000041943e in cpnd_proc_fill_sec_desc (pTmpSecPtr=0x0, 
sec_des=0x3e98796aa00) at cpnd_proc.c:1649
1649    cpnd_proc.c: No such file or directory.
        in cpnd_proc.c
(gdb) bt
#0  0x000000000041943e in cpnd_proc_fill_sec_desc (pTmpSecPtr=0x0, 
sec_des=0x3e98796aa00) at cpnd_proc.c:1649
#1  0x000000000041998a in cpnd_proc_getnext_section (cp_node=0x64ccd0, 
get_next=0x816930, sec_des=0x3e98796aa00, n_secs_trav=0x3e98796aa38) at 
cpnd_proc.c:1764
#2  0x0000000000410916 in cpnd_evt_proc_ckpt_iter_getnext (cb=0x64af80, 
evt=0x816920, sinfo=0x816f78) at cpnd_evt.c:4187
#3  0x0000000000405870 in cpnd_process_evt (evt=0x816910) at cpnd_evt.c:242
#4  0x0000000000412bda in cpnd_main_process (cb=0x64af80) at cpnd_init.c:568
#5  0x0000000000412dda in main (argc=2, argv=0x3e98796b2d8) at cpnd_main.c:72


----my functions-----
void ha_ckpt_sync_from_active (SaCkptCheckpointHandleT  checkpointHandle)
{
    SaAisErrorT rc;
    SaCkptSectionIterationHandleT iterate;
    SaCkptSectionDescriptorT secDesc;
    SaCkptIOVectorElementT readVector;
    SaUint32T erroneousVectorIndex;
    uint8_t  ckpt_data[4000];
    unsigned long checkptID = 0;
    HA_SYNC_DATA_HEADER *p_header = NULL;
    unsigned int validdata = 0;
    unsigned int invaliddata = 0;
    rc = saCkptSectionIterationInitialize(checkpointHandle,
                             SA_CKPT_SECTIONS_ANY, 0, &iterate);
    CHECK_AIS_ERROR (rc);
                  printf("begin show section:\n");
    while (1) {
        rc = saCkptSectionIterationNext(iterate, &secDesc);
        if (SA_AIS_OK != rc)
            break;

        readVector.sectionId.id = secDesc.sectionId.id;
        readVector.sectionId.idLen = secDesc.sectionId.idLen;
        readVector.dataBuffer = ckpt_data;
        readVector.dataSize = secDesc.sectionSize;
        readVector.dataOffset = 0;

        rc = saCkptCheckpointRead(checkpointHandle, &readVector, 1, 
&erroneousVectorIndex);
        if (SA_AIS_OK == rc)
        {
            p_header = (HA_SYNC_DATA_HEADER*)ckpt_data;
            memcpy(&checkptID, readVector.sectionId.id, sizeof(unsigned long));
            ha_log(LG_INF, DBGINFO"sync one 
record!!!>>ckptid:%#lx,opt:%#x,data:%d,"
                "hdatalen:%d,section info>>>>idtype:%d,rsize:%d,dsize:%d",
                        MDL, checkptID, p_header->opt_type, 
p_header->key_id_buf[8],
                        p_header->data_len, readVector.sectionId.id[8],
                        readVector.readSize, readVector.dataSize);
            if (p_header->data_len == 0) {
                invaliddata++;
                                ha_log(LG_WRN, "WRNING!!!!!!!!!!invalid 
data!!!!!!!!!!!!!\n\n");
            } else {
                validdata++;
                }

            //ha_ckpt_process_data((char*)ckpt_data, readVector.readSize);
        }
        else {
            memcpy(&checkptID,p_header->key_id_buf,sizeof(unsigned long));
            ha_log(LG_WRN, DBGINFO"WRN>>saCkptCheckpointRead 
failed!!!ckptid:%#lx,id type:%d,"
                "rsize:%d,dsize:%d",
                        MDL, checkptID, p_header->key_id_buf[8], 
readVector.readSize,
                        readVector.dataSize);
        }
    }
    printf("END show section!read total:%d,valid:%d,invalid:%d\n", 
validdata+invaliddata, validdata, invaliddata);
    rc = saCkptSectionIterationFinalize(iterate);
    CHECK_AIS_ERROR (rc);
}

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Opensaf-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-users

Reply via email to