dbTalk Databases Forums  

Problems with mysql_close() (function does not return) + potential bugs found

mailing.database.mysql-plusplus mailing.database.mysql-plusplus


Discuss Problems with mysql_close() (function does not return) + potential bugs found in the mailing.database.mysql-plusplus forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
RedFraggle
 
Posts: n/a

Default Problems with mysql_close() (function does not return) + potential bugs found - 11-28-2005 , 05:25 PM






------=_NextPart_000_0007_01C5F38C.E7EB84B0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I have a problem while calling mysql_close()

After the dtor of Connection() is called, the program hangs somewhere in =
libmysql after mysql_close() was called in:

Connection::~Connection()
{
mysql_close(&mysql_);
is_connected_ =3D false;
}

during debugging i found a potential problem, but it did not fix the =
problem.(i put some suggestions at the end of this mail)

In the problem might depend on the fact, that i still have a 'Result' =
stored somewhere else , which is not deleted while closing the =
connection , but i'm not sure (this would mean, that mysql_close() =
knows, there is a 'Result' somewhere and waits for closing it (?)...hard =
to believe...)



Any ideas what may cause the hanging and for what i should look?

-------------------------------------------------------------------------=
------

The code change i would suppose is the following:



bool Connection::connect(cchar* db, cchar* host, cchar* user,cchar* =
passwd, uint port, my_bool compress,
unsigned int connect_timeout, cchar* socket_name,
unsigned int client_flag)
{
lock();
// Drop previous connection, if any
if (connected())=20
{
disconnect();

// i added this line, becaus mysql_close deallocates memory
// which was allocated in mysql_init. this is necessary for the
// mysql_real_connect later in this function
mysql_init(&mysql_);=20


}

....
....
....
// Establish connection

if (mysql_real_connect(&mysql_, host, user, passwd, db, port,

-------------------------------------------------------------------------=
------



regards,

Timm von der Mehden

------=_NextPart_000_0007_01C5F38C.E7EB84B0--


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.