Fix 01822_async_read_from_socket_crash for hedged connection.

This commit is contained in:
Nikolai Kochetov 2021-07-16 13:42:22 +03:00
parent 2d42b1ebf6
commit 0d549c197f
2 changed files with 7 additions and 2 deletions

View File

@ -353,6 +353,11 @@ bool HedgedConnections::resumePacketReceiver(const HedgedConnections::ReplicaLoc
if (offset_states[location.offset].active_connection_count == 0 && !offset_states[location.offset].next_replica_in_process) if (offset_states[location.offset].active_connection_count == 0 && !offset_states[location.offset].next_replica_in_process)
throw NetException("Receive timeout expired", ErrorCodes::SOCKET_TIMEOUT); throw NetException("Receive timeout expired", ErrorCodes::SOCKET_TIMEOUT);
} }
else if (std::holds_alternative<std::exception_ptr>(res))
{
finishProcessReplica(replica_state, true);
std::rethrow_exception(std::move(std::get<std::exception_ptr>(res)));
}
return false; return false;
} }

View File

@ -31,7 +31,7 @@ public:
} }
/// Resume packet receiving. /// Resume packet receiving.
std::variant<int, Packet, Poco::Timespan> resume() std::variant<int, Packet, Poco::Timespan, std::exception_ptr> resume()
{ {
/// If there is no pending data, check receive timeout. /// If there is no pending data, check receive timeout.
if (!connection->hasReadPendingData() && !checkReceiveTimeout()) if (!connection->hasReadPendingData() && !checkReceiveTimeout())
@ -43,7 +43,7 @@ public:
/// Resume fiber. /// Resume fiber.
fiber = std::move(fiber).resume(); fiber = std::move(fiber).resume();
if (exception) if (exception)
std::rethrow_exception(std::move(exception)); return std::move(exception);
if (is_read_in_process) if (is_read_in_process)
return epoll.getFileDescriptor(); return epoll.getFileDescriptor();