TLS 线上问题

前面两篇博客了解了TLS的先关原理!现在开始直面实际问题了!!

问题:目前https cps为500时正常,但是cps为3000 时出现问题,查看log出现

//SSL_shut_down error.1 n=407、 相关log

 也就是shutdown的时候sslctx是SSL_R_SHUTDOWN_WHILE_IN_INIT

int SSL_shutdown(SSL *s)
{
    /*
     * Note that this function behaves differently from what one might
     * expect.  Return values are 0 for no success (yet), 1 for success; but
     * calling it once is usually not enough, even if blocking I/O is used
     * (see ssl3_shutdown).
     */

    if (s->handshake_func == 0) {
        SSLerr(SSL_F_SSL_SHUTDOWN, SSL_R_UNINITIALIZED);
        return -1;
    }

    if (!SSL_in_init(s)) {
        return s->method->ssl_shutdown(s);
    } else {
        SSLerr(SSL_F_SSL_SHUTDOWN, SSL_R_SHUTDOWN_WHILE_IN_INIT);
        return -1;
    }
}

 分析:

根据log分析:原因是ssl刚刚初始化后剩下的ssl_handshake 没有执行完就被干掉,现在要来看为什么ssl handshake被干掉;

看了一下openssl的代码逻辑 其主要为ssl 状态以及加密算法库

目前问题已经解决:根本原因是性能问题导致openssl三次握手逻辑超时被主动断开导致

 对于 openssl的错误处理 可以参考

 BIO_new_fp

SSLfatal  

相关接口

posted @ 2022-05-20 10:08  codestacklinuxer  阅读(63)  评论(0)    收藏  举报