Skip to content

Commit

Permalink
Do not move throttled session to epoll
Browse files Browse the repository at this point in the history
Epoll thread does not poll for EPOLLOUT. If a throttled session with
pending data out is moved to epoll thread, the session will stay in
epoll thread indefinitely, causing a hang observed by client. Fix by not
moving throttled session to epoll thread.

Fix sysown#1939
  • Loading branch information
carsonip committed Mar 19, 2019
1 parent e285dce commit 6c2e0dd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/MySQL_Thread.cpp
Expand Up @@ -2606,7 +2606,9 @@ void MySQL_Thread::run() {
if (myds->DSS==STATE_SLEEP && myds->sess->status==WAITING_CLIENT_DATA) {
unsigned long long _tmp_idle = mypolls.last_recv[n] > mypolls.last_sent[n] ? mypolls.last_recv[n] : mypolls.last_sent[n] ;
if (_tmp_idle < ( (curtime > (unsigned int)mysql_thread___session_idle_ms * 1000) ? (curtime - mysql_thread___session_idle_ms * 1000) : 0)) {
if (myds->sess->client_myds == myds && myds->PSarrayOUT->len==0 && (myds->queueOUT.head - myds->queueOUT.tail)==0 ) { // extra check
// make sure data stream has no pending data out and session is not throttled (#1939)
// because epoll thread does not handle data stream with data out
if (myds->sess->client_myds == myds && !myds->available_data_out() && myds->sess->pause_until <= curtime) {
unsigned int j;
int conns=0;
for (j=0;j<myds->sess->mybes->len;j++) {
Expand Down

0 comments on commit 6c2e0dd

Please sign in to comment.