MDEV-14781 - threadpool slowdown with slow ssl handshake.
Fix is not to use blocking socket IO during SSL handshake. With non-blocking socket IO, threadpool is able to utilize the wait notification callbacks, that vio_io_wait() is calling whenever socket would block.
This commit is contained in:
parent
54b8856b87
commit
04789ec801
10
vio/viossl.c
10
vio/viossl.c
@ -124,6 +124,9 @@ static my_bool ssl_should_retry(Vio *vio, int ret, enum enum_vio_io_event *event
|
|||||||
default:
|
default:
|
||||||
should_retry= FALSE;
|
should_retry= FALSE;
|
||||||
ssl_set_sys_error(ssl_error);
|
ssl_set_sys_error(ssl_error);
|
||||||
|
#ifndef HAVE_YASSL
|
||||||
|
ERR_clear_error();
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -315,21 +318,16 @@ static int ssl_do(struct st_VioSSLFd *ptr, Vio *vio, long timeout,
|
|||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
SSL *ssl;
|
SSL *ssl;
|
||||||
my_bool unused;
|
|
||||||
my_bool was_blocking;
|
|
||||||
my_socket sd= mysql_socket_getfd(vio->mysql_socket);
|
my_socket sd= mysql_socket_getfd(vio->mysql_socket);
|
||||||
DBUG_ENTER("ssl_do");
|
DBUG_ENTER("ssl_do");
|
||||||
DBUG_PRINT("enter", ("ptr: %p, sd: %d ctx: %p",
|
DBUG_PRINT("enter", ("ptr: %p, sd: %d ctx: %p",
|
||||||
ptr, (int)sd, ptr->ssl_context));
|
ptr, (int)sd, ptr->ssl_context));
|
||||||
|
|
||||||
/* Set socket to blocking if not already set */
|
|
||||||
vio_blocking(vio, 1, &was_blocking);
|
|
||||||
|
|
||||||
if (!(ssl= SSL_new(ptr->ssl_context)))
|
if (!(ssl= SSL_new(ptr->ssl_context)))
|
||||||
{
|
{
|
||||||
DBUG_PRINT("error", ("SSL_new failure"));
|
DBUG_PRINT("error", ("SSL_new failure"));
|
||||||
*errptr= ERR_get_error();
|
*errptr= ERR_get_error();
|
||||||
vio_blocking(vio, was_blocking, &unused);
|
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
}
|
}
|
||||||
DBUG_PRINT("info", ("ssl: %p timeout: %ld", ssl, timeout));
|
DBUG_PRINT("info", ("ssl: %p timeout: %ld", ssl, timeout));
|
||||||
@ -360,7 +358,6 @@ static int ssl_do(struct st_VioSSLFd *ptr, Vio *vio, long timeout,
|
|||||||
DBUG_PRINT("error", ("SSL_connect/accept failure"));
|
DBUG_PRINT("error", ("SSL_connect/accept failure"));
|
||||||
*errptr= SSL_errno(ssl, r);
|
*errptr= SSL_errno(ssl, r);
|
||||||
SSL_free(ssl);
|
SSL_free(ssl);
|
||||||
vio_blocking(vio, was_blocking, &unused);
|
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -371,7 +368,6 @@ static int ssl_do(struct st_VioSSLFd *ptr, Vio *vio, long timeout,
|
|||||||
*/
|
*/
|
||||||
if (vio_reset(vio, VIO_TYPE_SSL, SSL_get_fd(ssl), ssl, 0))
|
if (vio_reset(vio, VIO_TYPE_SSL, SSL_get_fd(ssl), ssl, 0))
|
||||||
{
|
{
|
||||||
vio_blocking(vio, was_blocking, &unused);
|
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user