Commit 1bb40458 authored by Marc Vef's avatar Marc Vef
Browse files

ifs: preload bug fixes

parent 5d1b8d10
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -55,13 +55,13 @@ extern FILE* debug_fd;
#define LD_LOG_DEBUG(fd, fmt, ...) \
            do { if (LOG_PRELOAD_DEBUG) fprintf(fd, "[" __DATE__ ":" __TIME__ "] [debug] " fmt, ##__VA_ARGS__); fflush(fd); } while (0)
#define LD_LOG_TRACE(fd, fmt, ...) \
            do { if (LOG_PRELOAD_TRACE) fprintf(fd, "[" __DATE__ ":" __TIME__ "] [debug]" fmt, ##__VA_ARGS__); fflush(fd); } while (0)
            do { if (LOG_PRELOAD_TRACE) fprintf(fd, "[" __DATE__ ":" __TIME__ "] [trace] " fmt, ##__VA_ARGS__); fflush(fd); } while (0)
#define LD_LOG_ERROR(fd, fmt, ...) \
            do { fprintf(fd, "[" __DATE__ ":" __TIME__ "] [err]" fmt, ##__VA_ARGS__); fflush(fd); } while (0)
#define LD_LOG_DEBUG0(fd, fmt) \
            do { if (LOG_PRELOAD_DEBUG) fprintf(fd, "[" __DATE__ ":" __TIME__ "] [debug] " fmt); fflush(fd); } while (0)
#define LD_LOG_TRACE0(fd, fmt) \
            do { if (LOG_PRELOAD_TRACE) fprintf(fd, "[" __DATE__ ":" __TIME__ "] [debug]" fmt); fflush(fd); } while (0)
            do { if (LOG_PRELOAD_TRACE) fprintf(fd, "[" __DATE__ ":" __TIME__ "] [trace] " fmt); fflush(fd); } while (0)
#define LD_LOG_ERROR0(fd, fmt) \
            do { fprintf(fd, "[" __DATE__ ":" __TIME__ "] [err]" fmt); fflush(fd); } while (0)

+1 −0
Original line number Diff line number Diff line
@@ -81,6 +81,7 @@ bool ipc_send_get_fs_config(const hg_id_t ipc_get_config_id) {
            fs_config->gid = out.gid;
            fs_config->host_id = out.host_id;
            fs_config->host_size = out.host_size;
            fs_config->rpc_port = to_string(RPCPORT);

            // split comma separated host string and create a hosts map
            string hosts_raw = out.hosts_raw;
+7 −3
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@
#include <atomic>
#include <cassert>

// TODO my god... someone clean up this mess of a file
// TODO my god... someone clean up this mess of a file :_:

static pthread_once_t init_lib_thread = PTHREAD_ONCE_INIT;

@@ -484,7 +484,8 @@ bool get_addr_by_hostid(const uint64_t hostid, hg_addr_t& svr_addr) {
        // not found, manual lookup and add address mapping to LRU cache
        auto hostname = RPC_PROTOCOL + "://"s + fs_config->hosts.at(hostid) + ":"s +
                        fs_config->rpc_port; // convert hostid to hostname and port
//        ADAFS_DATA->spdlogger()->debug("generated hostid {}", hostname);
        LD_LOG_TRACE(debug_fd, "generated hostname %s with rpc_port %s\n", hostname.c_str(),
                     fs_config->rpc_port.c_str());
        margo_addr_lookup(margo_rpc_id_, hostname.c_str(), &svr_addr);
        if (svr_addr == HG_ADDR_NULL)
            return false;
@@ -644,7 +645,7 @@ margo_instance_id ld_margo_ipc_id() {
}

margo_instance_id ld_margo_rpc_id() {
    return margo_ipc_id_;
    return margo_rpc_id_;
}


@@ -738,9 +739,12 @@ void destroy_preload(void) {
    LD_LOG_DEBUG0(debug_fd, "Finalizing Margo ...\n");
    margo_finalize(margo_ipc_id_);

    // TODO free all rpc addresses in LRU map and finalize margo rpc

    LD_LOG_DEBUG0(debug_fd, "Finalizing Argobots ...\n");
    ABT_finalize();

    // TODO destroy rpc context and class
    LD_LOG_DEBUG0(debug_fd, "Destroying Mercury context ...\n");
    HG_Context_destroy(mercury_ipc_context_);
    LD_LOG_DEBUG0(debug_fd, "Finalizing Mercury class ...\n");
+1 −1
Original line number Diff line number Diff line
@@ -74,7 +74,7 @@ int rpc_send_create_node(const hg_id_t rpc_create_node_id, const size_t recipien
    hg_bool_t success = HG_FALSE;
    // TODO HG_ADDR_T is never freed atm. Need to change LRUCache
    if (!get_addr_by_hostid(recipient, svr_addr)) {
        LD_LOG_ERROR(debug_fd, "server address not resolvable for host id %l\n", recipient);
        LD_LOG_ERROR(debug_fd, "server address not resolvable for host id %lu\n", recipient);
        return 1;
    }
    auto ret = HG_Create(margo_get_context(ld_margo_rpc_id()), svr_addr, rpc_create_node_id, &handle);