[freetds] 0.62.4 - got core in tds_free_socket

V.Kukushkin kvd at internet2.ru
Thu Dec 2 08:56:15 EST 2004


Hi all,
I have encountered the problem with connection to sql server in 0.62.4 (cvs)
To test connection function listed below I did following steps:
1) Start program (cable connected to network)
2) Make sql query and get positive result (means that tds socket is good)
3) Disconnect host cable from network
4) Got program aborted with core file

Debugger said:
#0  tds_free_results (res_info=0xffffffff) at mem.c:491
491             if (res_info->num_cols && res_info->columns) {
(gdb) bt
#0  tds_free_results (res_info=0xffffffff) at mem.c:491
#1  0x0805aa43 in tds_free_all_results (tds=0x81c3840) at mem.c:514
#2  0x0805b0c1 in tds_free_socket (tds=0x81c3840) at mem.c:767
#3  0x08054fcd in MSQLconn::Connect() (this=0x8173a14) at ../MSQLconn.cc:129
#4  0x0804a591 in PMstatThread_srv(void*) (arg=0x8174640)
    at test_dispatcher.cc:507
#5  0x080bed51 in pthread_start_thread ()

Who can say what's wrong here ? How to fix the problem ?
Thanks in advance
Vladimir
===================================================================
int MSQLconn::Connect()
{
    int errcode = 0;
    _sqlerror[0] = 0;
    if(!_tds_context || !_connect_info)
    {
        CDEBUG << "SQL: connection not initialized (host="<<_server<<"
login="<<_login<<")\n";
        return 1;
    }
    if(_tds )
        tds_free_socket(_tds);
    _tds = tds_alloc_socket(_tds_context, 512);
    if( !_tds )
    {
        CDEBUG << "SQL: socket allocation failed (host="<<_server<<"
login="<<_login<<")\n";
        return 1;
    }
    if(tds_connect(_tds, _connect_info) == TDS_FAIL)
    {
        CDEBUG << "SQL: connection failed (host="<<_server<<"
login="<<_login<<")\n";
        return 1;
    }
    if(_sqlerror[0])
        errcode = 1;
    return errcode;
}

---
Best regards,
Vladimir



More information about the FreeTDS mailing list