forked from mindspore-Ecosystem/mindspore
!38009 Fix scheduler timeout when crl is invalid
Merge pull request !38009 from ZPaC/fix-timeout-when-crl-invalid
This commit is contained in:
commit
aa07834bf1
|
@ -16,6 +16,7 @@
|
|||
|
||||
#include "ps/core/communicator/ssl_client.h"
|
||||
#include "ps/core/communicator/ssl_wrapper.h"
|
||||
#include "utils/ms_exception.h"
|
||||
#include "distributed/rpc/tcp/ssl_socket_operation.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
@ -229,24 +230,28 @@ void SSLSocketOperation::Handshake(int fd, Connection *conn) {
|
|||
return;
|
||||
}
|
||||
|
||||
// Failed to handshake.
|
||||
int err = SSL_get_error(ssl_, retval);
|
||||
auto err_msg = ERR_reason_error_string(err);
|
||||
MS_LOG(ERROR) << "Failed to do the ssl handshake, retval: " << retval << ", errno: " << err
|
||||
<< ", err info: " << err_msg;
|
||||
if (err == SSL_ERROR_WANT_WRITE) {
|
||||
(void)conn->recv_event_loop->UpdateEpollEvent(fd, EPOLLOUT | EPOLLHUP | EPOLLERR | EPOLLRDHUP);
|
||||
} else if (err == SSL_ERROR_WANT_READ) {
|
||||
(void)conn->recv_event_loop->UpdateEpollEvent(fd, EPOLLIN | EPOLLHUP | EPOLLERR | EPOLLRDHUP);
|
||||
} else {
|
||||
MS_LOG(ERROR) << "ssl handshake info -- retval:" << retval << ", error:" << err << ", errno:" << errno
|
||||
<< ", conn:" << conn->send_to.c_str();
|
||||
uint64_t error = 0;
|
||||
while ((error = ERR_get_error())) {
|
||||
MS_LOG(ERROR) << "ssl handshake errno: " << error << ", err info: " << ERR_reason_error_string(error);
|
||||
// Failed to handshake. Throw exception and catch it in main thread.
|
||||
try {
|
||||
int err = SSL_get_error(ssl_, retval);
|
||||
auto err_msg = ERR_reason_error_string(err);
|
||||
if (err == SSL_ERROR_WANT_WRITE) {
|
||||
(void)conn->recv_event_loop->UpdateEpollEvent(fd, EPOLLOUT | EPOLLHUP | EPOLLERR | EPOLLRDHUP);
|
||||
} else if (err == SSL_ERROR_WANT_READ) {
|
||||
(void)conn->recv_event_loop->UpdateEpollEvent(fd, EPOLLIN | EPOLLHUP | EPOLLERR | EPOLLRDHUP);
|
||||
} else {
|
||||
MS_LOG(ERROR) << "ssl handshake info -- retval:" << retval << ", error:" << err << ", errno:" << errno
|
||||
<< ", conn:" << conn->send_to.c_str();
|
||||
uint64_t error = 0;
|
||||
while ((error = ERR_get_error())) {
|
||||
MS_LOG(ERROR) << "ssl handshake errno: " << error << ", err info: " << ERR_reason_error_string(error);
|
||||
}
|
||||
conn->error_code = err;
|
||||
conn->state = ConnectionState::kDisconnecting;
|
||||
}
|
||||
conn->error_code = err;
|
||||
conn->state = ConnectionState::kDisconnecting;
|
||||
MS_LOG(EXCEPTION) << "Failed to do the ssl handshake, retval: " << retval << ", errno: " << err
|
||||
<< ", err info: " << err_msg;
|
||||
} catch (const std::exception &e) {
|
||||
MsException::Instance().SetException();
|
||||
}
|
||||
}
|
||||
} // namespace rpc
|
||||
|
|
Loading…
Reference in New Issue