Enable remote shutdown from same process
If a process is initialized as a server and called
margo_enable_remote_shutdown, then this same process issues a
margo_shutdown_remote_instance, Mercury will complain about an
hg_addr_t not being freed. The instance in question is the
hg_addr_t being passed to the shutdown RPC itself, which cannot be freed anymore when the RPC returns because Mercury has already finalized.
The fix should be to detect that
margo_shutdown_remote_instance is being invoked on the calling process itself, and call
margo_finalize instead of sending an RPC.