Skip to content

Commit

Permalink
Fix deadlock in destruction of Eventstream Client (#632)
Browse files Browse the repository at this point in the history
Co-authored-by: Bret Ambrose <bretambrose@gmail.com>
  • Loading branch information
sbSteveK and bretambrose authored Sep 28, 2023
1 parent bd45be3 commit eddd99c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions eventstream_rpc/source/EventStreamClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,11 @@ namespace Aws
{
std::promise<RpcError> errorPromise;
errorPromise.set_value({baseError, 0});
if (baseError == EVENT_STREAM_RPC_NULL_PARAMETER)
{
const std::lock_guard<std::recursive_mutex> lock(m_stateMutex);
m_clientState = DISCONNECTED;
}
return errorPromise.get_future();
}

Expand Down Expand Up @@ -353,6 +358,8 @@ namespace Aws
"A CRT error occurred while attempting to establish the connection: %s",
Crt::ErrorDebugString(crtError));
errorPromise.set_value({EVENT_STREAM_RPC_CRT_ERROR, crtError});
const std::lock_guard<std::recursive_mutex> lock(m_stateMutex);
m_clientState = DISCONNECTED;
return errorPromise.get_future();
}
else
Expand Down

0 comments on commit eddd99c

Please sign in to comment.