Skip to content

Commit a4011c9

Browse files
authored
IGNITE-27351 C++ Client: Fix compute job deadlock (#7234)
1 parent e745c1e commit a4011c9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

modules/platforms/cpp/ignite/client/detail/node_connection.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,12 @@ void node_connection::process_message(bytes_view msg) {
8686
auto pos = reader.position();
8787
bytes_view data{msg.data() + pos, msg.size() - pos};
8888

89-
{ // Locking scope
89+
std::shared_ptr<response_handler> handler{};
90+
{
9091
std::lock_guard<std::recursive_mutex> lock(m_request_handlers_mutex);
9192

92-
auto handler = find_handler_unsafe(req_id);
93+
handler = find_handler_unsafe(req_id);
94+
}
9395
if (!handler) {
9496
m_logger->log_error("Missing handler for request with id=" + std::to_string(req_id));
9597
return;
@@ -106,6 +108,8 @@ void node_connection::process_message(bytes_view msg) {
106108
m_logger->log_error("Uncaught user callback exception: " + result.error().what_str());
107109
}
108110

111+
{
112+
std::lock_guard<std::recursive_mutex> lock(m_request_handlers_mutex);
109113
if (handler->is_handling_complete()) {
110114
m_request_handlers.erase(req_id);
111115
}

0 commit comments

Comments
 (0)