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