Skip to content

Commit

Permalink
Prevent assert after fcntl() for O_NONBLOCK
Browse files Browse the repository at this point in the history
There are several asserts after fcntl() in
MySQL_Thread::create_new_session_and_client_data_stream() .
This commit removes the assert after F_SETFL with O_NONBLOCK.
This because it is possible that proxysql is already shutting down.
The entry in the error log is kept.
  • Loading branch information
renecannao committed Nov 2, 2023
1 parent 461d20e commit f16290d
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 f16290d

Please sign in to comment.