MySQL Forums
Forum List  »  Connector/C++

Block when query from mysql
Posted by: dapiao hehe
Date: September 18, 2017 03:44AM

Our server codes is always blocked like this:
(Thread 0x7f889ffff700 (LWP 128204)):
#0 0x0000000000dc0411 in read () at ../sysdeps/unix/syscall-template.S:82
#1 0x0000000000d620e2 in vio_read_buff ()
#2 0x0000000000d50f11 in my_real_read(st_net*, unsigned long*) ()
#3 0x0000000000d51a58 in my_net_read ()
#4 0x0000000000d4bbba in cli_safe_read ()
#5 0x0000000000d4ccd0 in cli_read_query_result ()
#6 0x0000000000d4db1e in mysql_real_query ()
#7 0x0000000000d406e5 in sql::mysql::MySQL_Statement::do_query (this=0x7f87ed07e040, q=0x7f87ed247288 "select * from CASINOUSERFISHSKILLINFO_2 where userid = 35326854", length=63)
at /game/mysql-connector-c++-1.0.5/driver/mysql_statement.cpp:73
#8 0x0000000000d40a02 in sql::mysql::MySQL_Statement::executeQuery (this=0x7f87ed07e040, sql=...) at /game/mysql-connector-c++-1.0.5/driver/mysql_statement.cpp:127

It happens once in one to two weeks, begins in several months, but it worked well before. And our DBA can't find issue from mysql server, it will be resolved if we restart our own server.

I think it seems to be tcp disconnect but not detected, but not sured and have no method to fix it.

I have tried to add OPT_WRITE_TIMEOUT and OPT_READ_TIMEOUT, but it doesn't work, or I use it wrongly

The OPT_WRITE_TIMEOUT and OPT_READ_TIMEOUT is used like this

std::map<std::string, sql::ConnectPropertyVal> mapConnectionProperties;
mapConnectionProperties["hostName"] = CreateConnectPropertyVal(iter->second);
mapConnectionProperties["userName"] = CreateConnectPropertyVal((i <= 7) ? username1 : username2);
mapConnectionProperties["password"] = CreateConnectPropertyVal((i <= 7) ? password1 : password2);
mapConnectionProperties["OPT_WRITE_TIMEOUT"] = CreateConnectPropertyVal(2);
mapConnectionProperties["OPT_READ_TIMEOUT"] = CreateConnectPropertyVal(2);

function CreateConnectPropertyVal is
ConnectPropertyVal CDBManager::CreateConnectPropertyVal(long long iValue) {
ConnectPropertyVal val;
val.lval = iValue;
return val;
}
Our mysql server version is 5.6.29
libmysqlcppconn version is 1.0.5
Can anyone help me, or anyone has meet the problem before? Thank you very much

Options: ReplyQuote


Subject
Views
Written By
Posted
Block when query from mysql
1375
September 18, 2017 03:44AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.