Fix possible writes to closed DCBs
When persistent connections were used, it was possible that the injection of COM_CHANGE_USER statements caused a crash when a DCB in the wrong state was accessed. For MySQL protocol modules, the `data` member of the client DCB points to the shared session data, a MYSQL_session struct, but for sessions in the persistent pool, it points to NULL. The boolean, `was_persistent`, tells whether a DCB was just taken from the pool or it has been in use. The `was_persistent` status wasn't properly reset for connections that were put into the pool which caused a COM_CHANGE_USER statement to be injected for stale connections in the pool which caused a crash when the NULL `data` member was accessed.
This commit is contained in:
@ -1827,6 +1827,7 @@ dcb_maybe_add_persistent(DCB *dcb)
|
||||
MXS_DEBUG("%lu [dcb_maybe_add_persistent] Adding DCB to persistent pool, user %s.\n",
|
||||
pthread_self(),
|
||||
dcb->user);
|
||||
dcb->was_persistent = false;
|
||||
dcb->dcb_is_zombie = false;
|
||||
dcb->persistentstart = time(NULL);
|
||||
if (dcb->session)
|
||||
|
Reference in New Issue
Block a user