Resolve "loopback on client - need a Gekko ENV variable or option as the server"

Closes #391 (closed)

Merge request reports

Loading
+5 −0
Changes for include/client/env.hpp: 5 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -100,6 +100,11 @@ static constexpr auto METADATA_BATCH_THRESHOLD =
        ADD_PREFIX("METADATA_BATCH_THRESHOLD");
static constexpr auto ASYNC_WRITE = ADD_PREFIX("ASYNC_WRITE");

// Libfabric interface pinning (consumed by libfabric at HG_init() time)
// OFI_INTERFACE is used with the GKFS_ prefix (e.g., LIBGKFS_OFI_INTERFACE)
// LIBGKFS_OFI_INTERFACE is the literal env var name for client-side pinning
static constexpr auto OFI_INTERFACE = ADD_PREFIX("OFI_INTERFACE");

} // namespace gkfs::env

#undef ADD_PREFIX
+8 −0
Changes for include/client/preload_context.hpp: 8 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -186,6 +186,8 @@ private:
    std::thread async_write_thread_;
    bool async_write_stop_{false};

    std::string ofi_interface_;


public:
    static PreloadContext*
@@ -434,6 +436,12 @@ public:
    void
    use_async_write(bool use_async_write);

    std::string
    ofi_interface() const;

    void
    ofi_interface(const std::string& ofi_interface);

    void
    start_async_write_thread();

+38 −0
Changes for include/common/rpc/handler_util.hpp: 38 added lines, 0 removed lines.
Original line number Diff line number Diff line
#pragma once
#include <thallium.hpp>
#include <spdlog/spdlog.h>

namespace gkfs::utils {

/**
 * @internal
 * Safe wrapper around thallium::request::respond() that contains
 * any margo_exception throws and logs them instead of aborting.
 * This is needed because respond() can throw when the client has
 * vanished mid-RPC (common in malleable workloads).
 * @endinternal
 */
template <typename RequestType, typename ResponseType>
void
safe_respond(RequestType& req, const ResponseType& resp) {
    try {
        req.respond(resp);
    } catch(const thallium::margo_exception& e) {
        // Client vanished — log and silently discard.
        // This is a normal part of malleable workloads, not an error.
        auto logger = spdlog::get("daemon");
        if(logger) {
            logger->debug(
                    "handler: client vanished mid-RPC, respond failed: {}",
                    e.what());
        }
    } catch(const std::exception& e) {
        // Unknown error — log but do not abort
        auto logger = spdlog::get("daemon");
        if(logger) {
            logger->error("handler: unexpected respond error: {}", e.what());
        }
    }
}

} // namespace gkfs::utils
 No newline at end of file
+11 −0
Changes for include/daemon/classes/fs_data.hpp: 11 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -117,6 +117,11 @@ private:
    bool enable_forwarding_ = false;
    std::string stats_file_;

    // Environment variables read at startup
    // Default: destroy hosts file on shutdown. Set keep_hosts_file to preserve
    // it.
    bool keep_hosts_file_ = false;

    // Prometheus
    std::string prometheus_gateway_ = gkfs::config::stats::prometheus_gateway;

@@ -328,6 +333,12 @@ public:
    void
    malleable_manager(const std::shared_ptr<gkfs::malleable::MalleableManager>&
                              malleable_manager);

    bool
    keep_hosts_file() const;

    void
    keep_hosts_file(bool keep);
};


+3 −2
Changes for include/daemon/handler/rpc_util.hpp: 3 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@
#include <daemon/backend/metadata/db.hpp>
#include <daemon/backend/data/chunk_storage.hpp>
#include <common/rpc/rpc_types_thallium.hpp>
#include <common/rpc/handler_util.hpp>
#include <thallium.hpp>

namespace gkfs::rpc {
@@ -108,7 +109,7 @@ run_rpc_handler(const tl::request& req, const InputType& in, Func func) {

    GKFS_DATA->spdlogger()->debug("{}() Sending output err '{}'", __func__,
                                  out.err);
    req.respond(out);
    gkfs::utils::safe_respond(req, out);
}

/**
@@ -147,7 +148,7 @@ run_rpc_handler(const tl::request& req, Func func) {

    GKFS_DATA->spdlogger()->debug("{}() Sending output err '{}'", __func__,
                                  out.err);
    req.respond(out);
    gkfs::utils::safe_respond(req, out);
}

} // namespace gkfs::rpc
Loading
Loading