Menu

Program Received signal SIGABRT

Developers
DrKarl
2009-12-29
2013-05-15
  • DrKarl

    DrKarl - 2009-12-29

    Hi,

       I get a SIGABRT signal while debugging my application. Before this function executes, I successfuly execute other functions performing 3 SELECTS, and an UPDATE, but in the following function performing a SELECT, when it gets to the end of the function I get a SIGABRT.

        vector<Mensaje> CSQLManager::getMsgData(JobInfo info)
        {
        TimeStamp timeStamp;
        strcpy(methodResult.methodName,"getMsgData");
        int rows = 0;
        MsgData msgData;
        Mensaje mensaje;
        vector<Mensaje> mensajes;
        struct tm when;
        memset(&when,0,sizeof(struct tm));
        DbRetVal rv = OK;
        AbsSqlConnection* conn = getConnection();
       
        AbsSqlStatement *stmt = SqlFactory::createStatement(CSql);
        stmt->setConnection(conn);
       
        char statement;
       
        strcpy(statement, "SELECT conversa_id, user_id, folder_id, action_date, mail_id, action FROM MSGDATA WHERE semestre_id=? AND asignatura_id='?' AND aula_id=? AND buzon_id='?';");
        printf("Prepare statement");
        rv = stmt->prepare(statement);
        if (rv != OK) {
        delete stmt;
        delete conn;
        methodResult.returnCode = 1;
        }
       
        msgData.info = info;
        printf("Binding fields");
        stmt->bindField(1, &msgData.conversa_id);
        stmt->bindField(2, &msgData.user_id);
        stmt->bindField(3, &msgData.folder_id);
        stmt->bindField(4, &timeStamp);
        stmt->bindField(5, &msgData.mail_id);
        stmt->bindField(6, msgData.action);
       
        rv = conn->beginTrans(); if(rv != OK) { methodResult.returnCode = 2;  }
       
        printf("Setting variables");
        stmt->setIntParam(1, info.semestre_id);
        stmt->setStringParam(2, info.asignatura_id);
        stmt->setIntParam(3, info.aula_id);
        stmt->setStringParam(4, info.buzon_id);
       
        stmt->execute(rows);
       
        printf("Fetching data");
       
        while (stmt->fetch() != NULL) {
        mensaje.semestre_id = info.semestre_id;
        mensaje.asignatura_id = info.asignatura_id;
        mensaje.aula_id = info.aula_id;
        mensaje.buzon_id = info.buzon_id;
        mensaje.folder_id = msgData.folder_id;
        mensaje.conversa_id = msgData.conversa_id;
        mensaje.user_id = msgData.user_id;
        mensaje.mail_id = msgData.mail_id;
        printf("Converting date");
        when.tm_year = timeStamp.year()-1900;
        when.tm_mon = timeStamp.month();
        when.tm_mday = timeStamp.dayOfMonth();
        when.tm_hour = timeStamp.hours();
        when.tm_min = timeStamp.minutes();
        when.tm_sec = timeStamp.seconds();
        mensaje.actionDate = mktime(&when);
        printf("Converting action");
        if (strcmp(msgData.action,"SEND") == 0) {
        mensaje.action = SEND;
        } else if (strcmp(msgData.action,"READ") == 0) {
        mensaje.action = READ;
        } else if (strcmp(msgData.action,"REPLY") == 0) {
        mensaje.action = REPLY;
        } else if (strcmp(msgData.action,"FORWARD") == 0 || strcmp(msgData.action,"FWD_AUT\r") == 0) {
        mensaje.action = FORWARD;
        } else if (strcmp(msgData.action,"DELETE") == 0) {
        mensaje.action = DELETE;
        }
       
        printf("Adding into vector");
        mensajes.push_back(mensaje);
        }
        stmt->close();
        printf("No more rows");
        rv = conn->commit();
        if (rv != OK) {
        delete stmt;
        delete conn;
        methodResult.returnCode = 3;
        }
        printf("Cleaning up");
        rv = stmt->free();
        delete stmt;
       
        printf("Returning messages");
        return mensajes;
        }

      I have tried commenting out some parts of the above code, and I have discovered that if I comment the "stmt->fetch" line, I don't get the SIGABRT signal, but of course I don't get any data either. With the above code, I get the data from the database and everything seems to work fine, until the SIGABRT signal.

    I am using the last build of CSQL under Ubuntu 9.10, my IDE of choice is CodeLite.

    Any hints on this?

    Thank you very much.

    Best Regards,

       Carlos
       

     
  • DrKarl

    DrKarl - 2009-12-29

    Hi again,

       This is the Call Stack after the SIGABRT:

        Level Address Function
        0     0x00990422 __kernel-vsyscall
        1     0x003ce4d1 raise
        2     0x003d1932 abort
        3     0x00404ee5 ??
        4     0x00484de8 __fortify_fail
        5     0x00484da0 __stack_chk_fail
        6     0x0805ca00 CSQLManager::getMsgData
        7     0x08050c52 GraphEngine::execute
        8     0x08050d2f main

    And the output in the shell is

        *** stack smashing detected ***: ./GraphCalc terminated
        ======= Backtrace: =========
        /lib/tls/i686/cmov/libc.so.6(__fortify_fail+0x48)
        /lib/tls/i686/cmov/libc.so.6(__fortify_fail+0x0)
        ./GraphCalc
        ./GraphCalc
        ./GraphCalc
        /lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe6)
        ./GraphCalc
        ======= Memory map: ========
        00110000-00296000 r-xp 00000000 08:01 8631       /usr/local/lib/libigraph.so.0.0
        .0
        00296000-00297000 --p 00186000 08:01 8631       /usr/local/lib/libigraph.so.0.0
        .0
        00297000-00298000 r-p 00186000 08:01 8631       /usr/local/lib/libigraph.so.0.0
        .0
        00298000-002dd000 rw-p 00187000 08:01 8631       /usr/local/lib/libigraph.so.0.0
        .0
        002dd000-002e1000 rw-p 00000000 00:00 0
        002e1000-002f3000 r-xp 00000000 08:01 174086     /opt/csql3.0-src/install/lib/li
        bcsqlnw.so
        002f3000-002f4000 r-p 00011000 08:01 174086     /opt/csql3.0-src/install/lib/li
        bcsqlnw.so
        002f4000-002f6000 rw-p 00012000 08:01 174086     /opt/csql3.0-src/install/lib/li
        bcsqlnw.so
        002f6000-002ff000 r-xp 00000000 08:01 174083     /opt/csql3.0-src/install/lib/li
        bcsqlsqllog.so
        002ff000-00300000 --p 00009000 08:01 174083     /opt/csql3.0-src/install/lib/li
        bcsqlsqllog.so
        00300000-00301000 r-p 00009000 08:01 174083     /opt/csql3.0-src/install/lib/li
        bcsqlsqllog.so
        00301000-00302000 rw-p 0000a000 08:01 174083     /opt/csql3.0-src/install/lib/li
        bcsqlsqllog.so
        00302000-0030c000 r-xp 00000000 08:01 174091     /opt/csql3.0-src/install/lib/li
        bcacheload.so
        0030c000-0030d000 r-p 00009000 08:01 174091     /opt/csql3.0-src/install/lib/li
        bcacheload.so
        0030d000-0030e000 rw-p 0000a000 08:01 174091     /opt/csql3.0-src/install/lib/li
        bcacheload.so
        0030e000-00372000 r-xp 00000000 08:01 100176     /usr/lib/libodbc.so.1.0.0
        00372000-00373000 r-p 00063000 08:01 100176     /usr/lib/libodbc.so.1.0.0
        00373000-00377000 rw-p 00064000 08:01 100176     /usr/lib/libodbc.so.1.0.0
        0043b000-00445000 r-xp 00000000 08:01 174092     /opt/csql3.0-src/install/lib/li
        bcsqlsqlnw.so
        00445000-00446000 r-p 00009000 08:01 174092     /opt/csql3.0-src/install/lib/li
        bcsqlsqlnw.so
        00446000-00447000 rw-p 0000a000 08:01 174092     /opt/csql3.0-src/install/lib/li
        bcsqlsqlnw.so
        00447000-00585000 r-xp 00000000 08:01 5072       /lib/tls/i686/cmov/libc-2.10.1.
        so
        00585000-00587000 r-p 0013e000 08:01 5072       /lib/tls/i686/cmov/libc-2.10.1.
        so
        00587000-00588000 rw-p 00140000 08:01 5072       /lib/tls/i686/cmov/libc-2.10.1.
        so
        00588000-0058b000 rw-p 00000000 00:00 0
        005b4000-005d8000 r-xp 00000000 08:01 5080       /lib/tls/i686/cmov/libm-2.10.1.
        so
        005d8000-005d9000 r-p 00023000 08:01 5080       /lib/tls/i686/cmov/libm-2.10.1.
        so
        005d9000-005da000 rw-p 00024000 08:01 5080       /lib/tls/i686/cmov/libm-2.10.1.
        so
        00629000-0062b000 r-xp 00000000 08:01 5078       /lib/tls/i686/cmov/libdl-2.10.1
        .so
        0062b000-0062c000 r-p 00001000 08:01 5078       /lib/tls/i686/cmov/libdl-2.10.1
        .so
        0062c000-0062d000 rw-p 00002000 08:01 5078       /lib/tls/i686/cmov/libdl-2.10.1
        .so
        0073c000-00751000 r-xp 00000000 08:01 5098       /lib/tls/i686/cmov/libpthread-2

    Am I missing the inizialization of any csql object?

    Best Regards,

      Carlos
       

     
  • DrKarl

    DrKarl - 2009-12-29

    Hi,

       Ok I think I solved the problem… I think it was one of those nasty C/C++ memory management errors…

    Greetings.

     

Log in to post a comment.