Verified Commit eb59130d authored by Tommaso Tocci's avatar Tommaso Tocci
Browse files

Margo Panic 2

parent 7313157e
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@
#include <memory>
#include <vector>
#include <string>
#include <margo.h>

/* Forward declarations */
class OpenFileMap;
@@ -51,6 +52,9 @@ class PreloadContext {
    std::shared_ptr<Distributor> distributor_;
    std::shared_ptr<FsConfig> fs_conf_;

    //Remove from here
    std::map<uint64_t, hg_addr_t> rpc_addresses_;

    std::string cwd_;
    std::vector<std::string> mountdir_components_;
    std::string mountdir_;
@@ -89,6 +93,8 @@ class PreloadContext {

    void initialized(const bool& flag);
    bool initialized() const;

    std::map<uint64_t, hg_addr_t>& rpc_addresses();
};


+2 −0
Original line number Diff line number Diff line
@@ -54,6 +54,8 @@ int get_daemon_pid();

bool read_system_hostfile();

hg_addr_t get_local_addr();

bool lookup_all_hosts();

void cleanup_addresses();
+8 −10
Original line number Diff line number Diff line
@@ -16,13 +16,12 @@ void send_minimal_ipc(const hg_id_t minimal_id) {
    printf("minimal RPC is running...\n");

    /* create handle */
    hg_addr_t local_addr;
    auto ret = margo_addr_self(ld_margo_rpc_id, &local_addr);
    if (ret != HG_SUCCESS) {
        CTX->log()->error("{}() unable to retrieve local address", __func__);
    auto local_addr = get_local_addr();
    if (local_addr == HG_ADDR_NULL) {
        CTX->log()->error("{}() Unable to lookup local addr", __func__);
        return;
    }
    ret = margo_create(ld_margo_rpc_id, local_addr, rpc_config_id, &handle);
    auto ret = margo_create(ld_margo_rpc_id, local_addr, rpc_config_id, &handle);
    if (ret != HG_SUCCESS) {
        margo_addr_free(ld_margo_rpc_id, local_addr);
        CTX->log()->error("{}() creating handle for failed", __func__);
@@ -60,13 +59,12 @@ bool ipc_send_get_fs_config() {
    ipc_config_out_t out{};
    // fill in
    in.dummy = 0; // XXX should be removed. havent checked yet how empty input with margo works
    hg_addr_t local_addr;
    auto ret = margo_addr_self(ld_margo_rpc_id, &local_addr);
    if (ret != HG_SUCCESS) {
        CTX->log()->error("{}() unable to retrieve local address", __func__);
    auto local_addr = get_local_addr();
    if (local_addr == HG_ADDR_NULL) {
        CTX->log()->error("{}() Unable to lookup local addr", __func__);
        return false;
    }
    ret = margo_create(ld_margo_rpc_id, local_addr, rpc_config_id, &handle);
    auto ret = margo_create(ld_margo_rpc_id, local_addr, rpc_config_id, &handle);
    if (ret != HG_SUCCESS) {
        margo_addr_free(ld_margo_rpc_id, local_addr);
        CTX->log()->error("{}() creating handle for failed", __func__);
+2 −1
Original line number Diff line number Diff line
@@ -102,6 +102,7 @@ bool init_margo_client(const std::string& na_plugin) {
 * This function is only called in the preload constructor and initializes Argobots and Margo clients
 */
void init_ld_environment_() {
    //use rpc_addresses here to avoid "static initialization order problem"
    if (!init_margo_client(RPC_PROTOCOL)) {
        CTX->log()->error("{}() Unable to initialize Margo IPC client.", __func__);
        exit(EXIT_FAILURE);
@@ -211,6 +212,6 @@ void destroy_preload() {
    // Might been solved in margo 0.3. It is not an issue with Omnipath for sure. Maybe CCI only issue.
    margo_finalize(ld_margo_rpc_id);
    CTX->log()->debug("{}() Shut down Margo RPC client successful", __func__);
    rpc_addresses.clear();
    CTX->rpc_addresses().clear();
    CTX->log()->info("All services shut down. Client shutdown complete.");
}
+5 −0
Original line number Diff line number Diff line
@@ -133,3 +133,8 @@ void PreloadContext::initialized(const bool& flag) {
bool PreloadContext::initialized() const {
    return initialized_;
}

std::map<uint64_t, hg_addr_t>& PreloadContext::rpc_addresses() {
    return rpc_addresses_;
}
Loading