Skip to content
Snippets Groups Projects
Commit 571ead77 authored by Carsten Patzke's avatar Carsten Patzke
Browse files

Replaced Fabric's timeout error with standard IO timeout error

parent e4f7f8a6
No related branches found
No related tags found
No related merge requests found
......@@ -11,7 +11,6 @@ enum class FabricErrorType {
kInternalConnectionError, // This might occur when the connection is unexpectedly closed
kNoDeviceFound,
kClientNotInitialized,
kTimeout,
kConnectionRefused,
};
......@@ -39,10 +38,6 @@ auto const kClientNotInitializedError = FabricErrorTemplate {
"The client was not initialized. Add server address first!",
FabricErrorType::kClientNotInitialized
};
auto const kTimeout = FabricErrorTemplate {
"Timeout",
FabricErrorType::kTimeout
};
auto const kConnectionRefusedError = FabricErrorTemplate {
"Connection refused",
FabricErrorType::kConnectionRefused
......
......@@ -284,13 +284,13 @@ void FabricContextImpl::InternalWait(FabricAddress targetAddress, FabricWaitable
// Check if we simply can wait for our task
task->Wait(requestTimeoutMs_, error);
if (*error == FabricErrorTemplates::kTimeout) {
if (*error == IOErrorTemplates::kTimeout) {
if (targetAddress == FI_ASAPO_ADDR_NO_ALIVE_CHECK) {
CancelTask(task, error);
// We expect the task to fail with 'Operation canceled'
if (*error == FabricErrorTemplates::kInternalOperationCanceledError) {
// Switch it to a timeout so its more clearly what happened
*error = FabricErrorTemplates::kTimeout.Generate();
*error = IOErrorTemplates::kTimeout.Generate();
}
} else {
InternalWaitWithAliveCheck(targetAddress, task, error);
......@@ -301,7 +301,7 @@ void FabricContextImpl::InternalWait(FabricAddress targetAddress, FabricWaitable
void FabricContextImpl::InternalWaitWithAliveCheck(FabricAddress targetAddress, FabricWaitableTask* task,
Error* error) {// Handle advanced alive check
bool aliveCheckFailed = false;
for (uint32_t i = 0; i < maxTimeoutRetires_ && *error == FabricErrorTemplates::kTimeout; i++) {
for (uint32_t i = 0; i < maxTimeoutRetires_ && *error == IOErrorTemplates::kTimeout; i++) {
*error = nullptr;
printf("HandleFiCommandAndWait - Tries: %d\n", i);
if (!TargetIsAliveCheck(targetAddress)) {
......@@ -316,7 +316,7 @@ void FabricContextImpl::InternalWaitWithAliveCheck(FabricAddress targetAddress,
if (aliveCheckFailed) {
*error = FabricErrorTemplates::kInternalConnectionError.Generate();
} else if(*error == FabricErrorTemplates::kInternalOperationCanceledError) {
*error = FabricErrorTemplates::kTimeout.Generate();
*error = IOErrorTemplates::kTimeout.Generate();
}
}
......
......@@ -141,7 +141,7 @@ class FabricContextImpl : public FabricContext {
// Success
break;
case FI_EAGAIN: // We felt trough our own timeout loop
*error = FabricErrorTemplates::kTimeout.Generate();
*error = IOErrorTemplates::kTimeout.Generate();
break;
case FI_ENOENT:
*error = FabricErrorTemplates::kConnectionRefusedError.Generate();
......
#include <common/io_error.h>
#include "fabric_waitable_task.h"
#include "../../fabric_internal_error.h"
......@@ -21,7 +22,7 @@ void FabricWaitableTask::HandleErrorCompletion(const fi_cq_err_entry* errEntry)
void FabricWaitableTask::Wait(uint32_t sleepInMs, Error* error) {
if (sleepInMs) {
if (future_.wait_for(std::chrono::milliseconds(sleepInMs)) == std::future_status::timeout) {
*error = FabricErrorTemplates::kTimeout.Generate();
*error = IOErrorTemplates::kTimeout.Generate();
return;
}
} else {
......
......@@ -31,6 +31,8 @@ Error GetLastErrorFromErrno() {
switch (errno) {
case 0:
return nullptr;
case EINTR:
return TextError("Interrupt occurred, is a debugger attached?");
case EBADF:
return IOErrorTemplates::kBadFileNumber.Generate();
case EAGAIN:
......
......@@ -7,6 +7,7 @@
#include <mutex>
#include "asapo_fabric/asapo_fabric.h"
#include "net_client.h"
#include "common/networking.h"
namespace asapo {
......
......@@ -4,6 +4,7 @@
#include <logger/logger.h>
#include <testing.h>
#include <asapo_fabric/asapo_fabric.h>
#include <common/io_error.h>
using namespace asapo;
using namespace fabric;
......@@ -64,7 +65,7 @@ void ClientThread(const std::string& hostname, uint16_t port) {
"The following call might take a while since its able to reach the server but the server is not responding"
<< std::endl;
client->Recv(serverAddress, 0, &dummyBuffer, sizeof(dummyBuffer), &err);
M_AssertEq(FabricErrorTemplates::kTimeout, err, "client->Recv");
M_AssertEq(IOErrorTemplates::kTimeout, err, "client->Recv");
err = nullptr;
serverShutdown.set_value();
......
......@@ -16,7 +16,7 @@ void ServerThread(FabricServer* server, size_t bufferSize, FileData* buffer) {
GenericRequestHeader request;
server->RecvAny(&clientAddress, &messageId, &request, sizeof(request), &error);
if (error == FabricErrorTemplates::kTimeout) {
if (error == IOErrorTemplates::kTimeout) {
error = nullptr;
continue;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment