Skip to Content.
Sympa Menu

freetds - Re: sigsegv in tds_submit_query

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: mark <snowdog AT zserve.com>
  • To: "TDS Development Group" <freetds AT franklin.metalab.unc.edu>, "Brian Bruns" <camber AT ais.org>
  • Subject: Re: sigsegv in tds_submit_query
  • Date: Tue, 10 Sep 2002 16:59:48 -0700



On Tuesday 10 September 2002 12:17 pm, Brian Bruns wrote:
> What calls are you making prior to tds_submit_query to set things up?



TDSLOGIN * tds_login = NULL;
TDSSOCKET * tds_socket = NULL;
TDSCONTEXT * context = NULL;


string host;
string user;
string pass;
string server;

void set_host (string & _host) { host = _host; }
void set_user (string & _user) { user = _user; }
void set_pass (string & _pass) { pass = _pass; }
void set_server (string & _server) { server = _server; }



void new_connection ()
{
tds_login = tds_alloc_login ();
cout << "attempting to connect to " << server << endl;
tds_set_host (tds_login, (char *)host.c_str ());
tds_set_user (tds_login, (char *)user.c_str ());
tds_set_passwd (tds_login, (char *)pass.c_str ());
tds_set_version (tds_login, 7,0);
tds_set_port (tds_login, 1433);
tds_set_app (tds_login, "imd");
tds_set_timeouts (tds_login, 0, 0, 0);
tds_set_library (tds_login, "TDS-Library");
tds_set_charset (tds_login, "iso_1");
tds_set_language (tds_login, "us_english");
tds_set_packet (tds_login, 512);
tds_set_server (tds_login, (char *)server.c_str ());


context = tds_alloc_context ();
if (context->locale && !context->locale->date_fmt)
{
context->locale->date_fmt = strdup ("%b %e %Y %l:%M%p");
}
context->msg_handler = _handle_message;
context->err_handler = _handle_message;

tds_socket = tds_connect(tds_login, context, NULL);

if (!tds_socket)
{
cerr << "unable to connect to " << server << endl;
}

do_query (tds_socket, "use thedb");
}




>
> > On Monday 09 September 2002 06:12 pm, James K. Lowden wrote:
> > > On Mon, 9 Sep 2002 12:36:56 -0700, "mark" <snowdog AT zserve.com> wrote:
> > > > I'm getting sigsegv's in tds_submit_query (CVS HEAD updated this
> > > > morning).
> > > >
> > > > Just wondering if its possible that the connection is getting ruined
> > > > somehow either by the database closing it or what. Is there any way I
> > > > can test a TDSSOCKET object to make sure that it won't cause tds_*
> > > > functions to sigsegv?
> > >
> > > Has anyone reproduced this? tsql works for me.
> > >
> > > Mark, what's the client architecture, and can you provide a backtrace?
> > >
> > > --jkl
> >
> > I'm using Kylix 3, so the backtrace is kinda weird.
> >
> > libpthread.pthread_mutex_lock + 0x17
> > libc.free + 0xa3
> > tds_free_column + 0x24
> > imd.tds_free_results + 0x85
> > tds_free_all_results + 0x15
> > imd.tds_submit_query + 0x6d
> >
> > All this is running on gentoo linux gcc 2.95x connecting to MS SQL
> > Server= 2000=20
> > on Windows 2000.
> >
> > here's an ldd on my program:
> > mark@mark imd $ ldd imd
> > libdl.so.2 =3D> /lib/libdl.so.2 (0x4002b000)
> > libm.so.6 =3D> /lib/libm.so.6 (0x4002f000)
> > libpthread.so.0 =3D> /lib/libpthread.so.0 (0x40051000)
> > libc.so.6 =3D> /lib/libc.so.6 (0x40067000)
> > /lib/ld-linux.so.2 =3D> /lib/ld-linux.so.2 (0x40000000)
> >
> >
> > I have verified that the parameters I'm passing to tds_submit_query are
> > v= alid:
> > The TDSSOCKET is correct. The query is also valid, that is it is quite
> > sh= ort=20
> > and null terminated. The TDSSOCKET, interestingly enough, gets hosed
> > afte= r=20
> > the sigsegv. All the data in the TDSSOCKET structure is altered=20
> > significantly.
> >
> > =2E/configure --eneable-threadsafe --tdsver=3D7.0
> >
> > is how I configured it.
> >
> >
> > Thanks,
> >
> > Mark
>
> ---
> You are currently subscribed to freetds as: [snowdog AT zserve.com]
> To unsubscribe, forward this message to
> $subst('Email.Unsub')





Archive powered by MHonArc 2.6.24.

Top of Page