Merge pull request #4375 from sysown/v2.x-231102

Prevent assert after fcntl() for O_NONBLOCK
pull/4381/head
René Cannaò 3 years ago committed by GitHub
commit 2d0c8bf6f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2893,8 +2893,12 @@ MySQL_Session * MySQL_Thread::create_new_session_and_client_data_stream(int _fd)
int nb = fcntl(_fd, F_SETFL, prevflags | O_NONBLOCK);
if (nb == -1) {
proxy_error("For FD %d fcntl() returned -1 , previous flags %d , errno %d\n", _fd, prevflags, errno);
if (shutdown == 0)
assert (nb != -1);
// previously we were asserting here. But it is possible that this->shutdown is still 0 during the
// shutdown itself:
// - the current thread is processing connections
// - the signal handler thread is still setting shutdown = 0
//if (shutdown == 0)
// assert (nb != -1);
}
}
setsockopt(sess->client_myds->fd, IPPROTO_TCP, TCP_NODELAY, (char *) &arg_on, sizeof(arg_on));

Loading…
Cancel
Save