Skip to content

Commit

Permalink
Merge pull request #4375 from sysown/v2.x-231102
Browse files Browse the repository at this point in the history
Prevent assert after fcntl() for O_NONBLOCK
  • Loading branch information
renecannao authored Nov 3, 2023
2 parents 461d20e + f16290d commit 2d0c8bf
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/MySQL_Thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 2d0c8bf

Please sign in to comment.