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: "V.Kukushkin" <kvd AT internet2.ru>
  • 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 18:41:02 +0300

Please don't care of test "if(_tds)". It is not NULL all the time.
But fact is that I am getting core dump and most important gdb print:
> #0 tds_free_results (res_info=0xffffffff) at mem.c:491
Why res_info=0xffffffff ? What is it mean ? How could it happen ?
I supply tds dump below. Is it started upon each request ?
BTW res_info changes from run to run.
Oh, forgot to say that I've patched write.c as you wrote (tds->state):

*** write.c Thu Dec 2 10:20:33 2004
--- write.c.org Thu Mar 18 13:30:21 2004
*************** goodwrite(TDSSOCKET * tds)
*** 449,457 ****
tdsdump_log(TDS_DBG_NETWORK, "TDS: Write failed in
tds_w
rite_packet\nError: %d (%s)\n", sock_errno,
strerror(sock_errno));
tds_client_msg(tds->tds_ctx, tds, 20006, 9, 0, 0,
"Write
to SQL Server failed.");
- /* << KUK - patch from ZIGLIO */
- tds->state = TDS_DEAD;
- /* >> KUK */
tds->in_pos = 0;
tds->in_len = 0;
tds_close_socket(tds);
--- 449,454 ----
---
Best regards,
Vladimir

=============================================
[kvd@wide test]$ cat tds_dump.log
Starting log file for FreeTDS 0.62.4
on 2004-12-02 18:24:50 with debug level 99.
iconv to convert client-side data to the "iso_1" character set
18:24:50.299540 tds_iconv_info_init: converting "ISO-8859-1"->"UCS-2LE"
18:24:50.299606 Connecting to 192.168.100.5 port 1433, TDS 4.2.
Sending packet @ 18:24:53.298081
0000 02 00 02 00 00 00 00 00-77 69 64 65 00 00 00 00 |........ wide....|
0010 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
0020 00 00 00 00 00 00 04 69-73 70 00 00 00 00 00 00 |.......i sp......|
0030 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
[skipped passwd etc.]
00e0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
00f0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
0100 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
0110 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
0120 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
0130 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
0140 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
0150 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
0160 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
0170 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
0180 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
0190 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
01a0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
01b0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
01c0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
01d0 00 08 04 02 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
01e0 00 00 00 00 00 00 0d 11-75 73 5f 65 6e 67 6c 69 |........ us_engli|
01f0 73 68 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |sh...... ........|


TDS: Write failed in tds_write_packet
Error: 113 (No route to host)
18:24:53.298953 tds_client_msg: #20006: "Write to SQL Server failed.".
Connection state is now 0.
18:24:53.299044 tds_process_login_tokens()
18:24:53.299079 looking for login token, got 0()
18:24:53.299112 tds_process_default_tokens() marker is 0()
18:24:53.299145 leaving tds_process_default_tokens() connection dead
18:24:53.299250 tds_client_msg: #20014: "Login incorrect.". Connection
state is now 4.

=============================================

----- Original Message -----
From: ZIGLIO, Frediano, VF-IT
To: FreeTDS Development Group
Sent: Thursday, December 02, 2004 5:40 PM
Subject: RE: [freetds] 0.62.4 - got core in tds_free_socket


>
> 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
_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds





Archive powered by MHonArc 2.6.24.

Top of Page