Verified Commit 105158f2 authored by Alberto Miranda's avatar Alberto Miranda ♨️
Browse files

Fix HG_address leak due to wrong destructor order

parent 5dfc9820
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -96,6 +96,8 @@ class PreloadContext {

    const std::vector<hermes::endpoint>& hosts2() const;
    void hosts2(const std::vector<hermes::endpoint>& addrs);
    void clear_hosts();


    uint64_t local_host_id() const;
    void local_host_id(uint64_t id);
+4 −0
Original line number Diff line number Diff line
@@ -308,6 +308,10 @@ void destroy_preload() {
        return;
    }
    cleanup_addresses();

    CTX->log()->debug("{}() About to finalize the Hermes RPC client", __func__);
    ld_network_service.reset();

    CTX->log()->debug("{}() About to finalize the margo RPC client", __func__);
    // XXX Sometimes this hangs on the cluster. Investigate.
    margo_finalize(ld_margo_rpc_id);
+5 −0
Original line number Diff line number Diff line
@@ -66,6 +66,7 @@ const std::vector<hg_addr_t>& PreloadContext::hosts() const {
void PreloadContext::hosts(const std::vector<hg_addr_t>& addrs) {
    hosts_ = addrs;
}

#endif

const std::vector<hermes::endpoint>& PreloadContext::hosts2() const {
@@ -76,6 +77,10 @@ void PreloadContext::hosts2(const std::vector<hermes::endpoint>& endpoints) {
    hosts2_ = endpoints;
}

void PreloadContext::clear_hosts() {
    hosts2_.clear();
}

uint64_t PreloadContext::local_host_id() const {
    return local_host_id_;
}
+4 −0
Original line number Diff line number Diff line
@@ -259,9 +259,13 @@ void load_hosts() {
}

void cleanup_addresses() {
#if 1 //TODO(amiranda) remove
    for (auto& addr: CTX->hosts()) {
        margo_addr_free(ld_margo_rpc_id, addr);
    }
#endif

    CTX->clear_hosts();
}


+4 −0
Original line number Diff line number Diff line
@@ -101,6 +101,10 @@ ssize_t write(const string& path, const void* buf, const bool append_flag,
    std::vector<hermes::rpc_handle<gkfs::rpc::write_data>> handles;

    // Issue non-blocking RPC requests and wait for the result later
    //
    // TODO(amiranda): This could be simplified by adding a vector of inputs
    // to async_engine::broadcast(). This would allow us to avoid manually 
    // looping over handles as we do below
    for(const auto& target : targets) {

        // total chunk_size for target