List:MySQL++« Previous MessageNext Message »
From:RedFraggle Date:November 27 2005 6:58pm
Subject:Problems with mysql_close() (function does not return) + potential bugs found
View as plain text  
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:

    is_connected_ = 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)
// Drop previous connection, if any
if (connected()) 

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


// Establish connection

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



Timm von der Mehden

Problems with mysql_close() (function does not return) + potential bugs foundRedFraggle29 Nov
  • Re: Problems with mysql_close() (function does not return) + potentialbugs foundWarren Young29 Nov