Merge branch 'crashthread' into v1.2.0

connleak
René Cannaò 10 years ago
commit 5539da7341

@ -27,7 +27,9 @@ extern int gdbg;
#define proxy_debug(module, verbosity, fmt, ...)
#endif /* DEBUG */
/*
#ifdef DEBUG
*/
#define proxy_error(fmt, ...) \
do { \
time_t __timer; \
@ -38,6 +40,7 @@ extern int gdbg;
strftime(__buffer, 25, "%Y-%m-%d %H:%M:%S", __tm_info); \
proxy_error_func("%s %s:%d:%s(): [ERROR] " fmt, __buffer, __FILE__, __LINE__, __func__ , ## __VA_ARGS__); \
} while(0)
/*
#else
#define proxy_error(fmt, ...) \
do { \
@ -50,8 +53,10 @@ extern int gdbg;
proxy_error_func("%s [ERROR] " fmt , __buffer , ## __VA_ARGS__); \
} while(0)
#endif
*/
/*
#ifdef DEBUG
*/
#define proxy_warning(fmt, ...) \
do { \
time_t __timer; \
@ -62,6 +67,7 @@ extern int gdbg;
strftime(__buffer, 25, "%Y-%m-%d %H:%M:%S", __tm_info); \
proxy_error_func("%s %s:%d:%s(): [WARNING] " fmt, __buffer, __FILE__, __LINE__, __func__ , ## __VA_ARGS__); \
} while(0)
/*
#else
#define proxy_warning(fmt, ...) \
do { \
@ -74,7 +80,7 @@ extern int gdbg;
proxy_error_func("%s [WARNING] " fmt , __buffer , ## __VA_ARGS__); \
} while(0)
#endif
*/
#ifdef DEBUG
#define proxy_info(fmt, ...) \
do { \

@ -1094,7 +1094,7 @@ handler_again:
if (myerr > 2000) {
bool retry_conn=false;
// client error, serious
proxy_error("Detected a broken connection during query on (%d,%s,%d) : %d, %s\n", myconn->parent->myhgc->hid, myconn->parent->address, myconn->parent->port, myerr, mysql_error(myconn->mysql));
proxy_error("Detected a broken connection during query on (%d,%s,%d) , FD (Conn:%d , MyDS:%d) : %d, %s\n", myconn->parent->myhgc->hid, myconn->parent->address, myconn->parent->port, myds->fd, myds->myconn->fd, myerr, mysql_error(myconn->mysql));
//if ((myds->myconn->reusable==true) && ((myds->myprot.prot_status & SERVER_STATUS_IN_TRANS)==0)) {
if (myds->query_retries_on_failure > 0) {
myds->query_retries_on_failure--;
@ -1484,12 +1484,14 @@ handler_again:
assert(st==status);
unsigned long long curtime=monotonic_time();
//mybe->server_myds->myprot.init(&mybe->server_myds, mybe->server_myds->myconn->userinfo, this);
if (myds->mypolls==NULL) {
thread->mypolls.add(POLLIN|POLLOUT, mybe->server_myds->fd, mybe->server_myds, curtime);
}
/* */
assert(myconn->async_state_machine!=ASYNC_IDLE);
rc=myconn->async_connect(myds->revents);
if (myds->mypolls==NULL) {
// connection yet not in mypolls
myds->assign_fd_from_mysql_conn();
thread->mypolls.add(POLLIN|POLLOUT, mybe->server_myds->fd, mybe->server_myds, curtime);
}
switch (rc) {
case 0:
myds->myds_type=MYDS_BACKEND;

@ -1779,7 +1779,19 @@ void MySQL_Thread::run() {
// check for timeout
} else {
// check if the FD is valid
assert(mypolls.fds[n].revents!=POLLNVAL);
if (mypolls.fds[n].revents==POLLNVAL) {
// debugging output before assert
MySQL_Data_Stream *_myds=mypolls.myds[n];
if (_myds) {
if (_myds->myconn) {
proxy_error("revents==POLLNVAL for FD=%d, events=%d, MyDSFD=%d, MyConnFD=%d\n", mypolls.fds[n].fd, mypolls.fds[n].events, myds->fd, myds->myconn->fd);
assert(mypolls.fds[n].revents!=POLLNVAL);
}
}
// if we reached her, we didn't assert() yet
proxy_error("revents==POLLNVAL for FD=%d, events=%d, MyDSFD=%d\n", mypolls.fds[n].fd, mypolls.fds[n].events, myds->fd);
assert(mypolls.fds[n].revents!=POLLNVAL);
}
switch(myds->myds_type) {
// Note: this logic that was here was removed completely because we added mariadb client library.
case MYDS_LISTENER:

@ -458,7 +458,7 @@ handler_again:
case ASYNC_CONNECT_END:
if (!ret_mysql) {
// always increase the counter
proxy_error("Failed to mysql_real_connect() on %s:%d , %d: %s\n", parent->address, parent->port, mysql_errno(mysql), mysql_error(mysql));
proxy_error("Failed to mysql_real_connect() on %s:%d , FD (Conn:%d , MyDS:%d) , %d: %s.\n", parent->address, parent->port, mysql->net.fd , myds->fd, mysql_errno(mysql), mysql_error(mysql));
NEXT_IMMEDIATE(ASYNC_CONNECT_FAILED);
} else {
NEXT_IMMEDIATE(ASYNC_CONNECT_SUCCESSFUL);

Loading…
Cancel
Save