Skip to Content.
Sympa Menu

freetds - RE: [freetds] 0.62.4 - got core in tds_free_socket

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio AT vodafone.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] 0.62.4 - got core in tds_free_socket
  • Date: Thu, 2 Dec 2004 15:40:13 +0100

>
> 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;
> }
>

This should be a partial program. Well you call MSQLconn::Connect, issue
a query and get a results. Then you unplug the cable. Now I don't
understand which code call MSQLconn::Connect again... also in 0.62/0.63
(not in 0.64) if tds_connect return failure TDSSOCKET it's no more
valid. You should then set _tds to NULL.
Can you post FreeTDS dump ?

freddy77




Archive powered by MHonArc 2.6.24.

Top of Page