diff -up ./vio/viossl.c.orig ./vio/viossl.c
--- ./vio/viossl.c.orig	2020-09-15 21:01:25.977338229 -0400
+++ ./vio/viossl.c	2020-09-16 12:15:27.197864624 -0400
@@ -108,6 +108,20 @@ static my_bool ssl_should_retry(Vio *vio
   int ssl_error;
   SSL *ssl= vio->ssl_arg;
   my_bool should_retry= TRUE;
+  unsigned long err;
+
+  while (1) {
+    err = ERR_peek_error();
+    DBUG_PRINT("info",("peek err=0x%lx",err));
+    if (ERR_GET_LIB(err) == ERR_LIB_X509
+	       && ERR_GET_REASON(err) == X509_R_CERT_ALREADY_IN_HASH_TABLE) {
+      err = ERR_get_error(); /* pop it off */
+      DBUG_PRINT("info",("discarding harmless X509 dup hash table error"));
+    } else {
+      break;
+    }
+  }
+
 
   /* Retrieve the result for the SSL I/O operation. */
   ssl_error= SSL_get_error(ssl, ret);
@@ -121,15 +135,20 @@ static my_bool ssl_should_retry(Vio *vio
   case SSL_ERROR_WANT_WRITE:
     *event= VIO_IO_EVENT_WRITE;
     break;
+  case SSL_ERROR_NONE:
+  case SSL_ERROR_SYSCALL:
+    DBUG_PRINT("info",("harmless? ssl_error=%d",ssl_error));
+    ERR_print_errors_fp(DBUG_FILE);
+    break;
   default:
     should_retry= FALSE;
+    DBUG_PRINT("info", ("ssl_error=%d",ssl_error));
     ssl_set_sys_error(ssl_error);
 #ifndef HAVE_YASSL
     ERR_clear_error();
 #endif
     break;
   }
-
   return should_retry;
 }
 
@@ -147,6 +166,7 @@ size_t vio_ssl_read(Vio *vio, uchar *buf
     ret= my_ssl_read_async(vio->async_context, (SSL *)vio->ssl_arg, buf, (int)size);
   else
   {
+    ERR_clear_error();
     while ((ret= SSL_read(ssl, buf, (int)size)) < 0)
     {
       enum enum_vio_io_event event;
@@ -180,6 +200,7 @@ size_t vio_ssl_write(Vio *vio, const uch
                             (int)size);
   else
   {
+    ERR_clear_error();
     while ((ret= SSL_write(ssl, buf, (int)size)) < 0)
     {
       enum enum_vio_io_event event;
@@ -234,6 +255,7 @@ int vio_ssl_close(Vio *vio)
     */
     SSL_set_quiet_shutdown(ssl, 1); 
     
+    ERR_clear_error();
     switch ((r= SSL_shutdown(ssl))) {
     case 1:
       /* Shutdown successful */
@@ -294,6 +316,8 @@ static int ssl_handshake_loop(Vio *vio,
   vio->ssl_arg= ssl;
 
   /* Initiate the SSL handshake. */
+  DBUG_PRINT("info",("handshake, clear initial errors"));
+  ERR_print_errors_fp(DBUG_FILE);
   while ((ret= func(ssl)) < 1)
   {
     enum enum_vio_io_event event;
@@ -305,6 +329,9 @@ static int ssl_handshake_loop(Vio *vio,
     /* Wait for I/O so that the handshake can proceed. */
     if (vio_socket_io_wait(vio, event))
       break;
+
+    DBUG_PRINT("info",("handshake, after wait for io"));
+    ERR_print_errors_fp(DBUG_FILE);
   }
 
   vio->ssl_arg= NULL;
