How to access packed function from a child thread?

I created a thread in c++ runtime and Im trying to call a packed function registered from python.

std::string RPCGetPath(const std::string& name) {
  static const PackedFunc* f =
      runtime::Registry::Get("tvm.rpc.server.workpath");
  CHECK(f != nullptr) << "require tvm.rpc.server.workpath";
  return (*f)(name);
}

The packed function is registed properly and Get("tvm.rpc.server.workpath") is returning a valid pointer
But return (*f)(name); is hanging.

The thread was created using std::async function.

Is it because of any lock its getting hanged? How to resolve this? Please help.

This is the callstack

#0  0x00007ffff7bc3f85 in futex_abstimed_wait_cancelable (private=<optimized out>, abstime=0x7fffe47bf9c0, expected=0, futex_word=0xa8b1e8) at ../sysdeps/unix/sysv/linux/futex-internal.h:205
#1  __pthread_cond_wait_common (abstime=0x7fffe47bf9c0, mutex=0xa8b180, cond=0xa8b1c0) at pthread_cond_wait.c:539
#2  __pthread_cond_timedwait (cond=0xa8b1c0, mutex=0xa8b180, abstime=0x7fffe47bf9c0) at pthread_cond_wait.c:667
#3  0x000000000054efcc in ?? ()
#4  0x0000000000550759 in PyEval_RestoreThread ()
#5  0x0000000000429760 in PyGILState_Ensure ()
#6  0x00007fffe4d633aa in __pyx_f_4core_tvm_callback (__pyx_v_args=0x7fffe47bfc30, __pyx_v_type_codes=0x7fffe47bfc10, __pyx_v_num_args=1, __pyx_v_ret=0x7fffe47bfbc0, __pyx_v_fhandle=0x7fffe47f10d0)
    at tvm/_ffi/_cython/core.cpp:3386
#7  0x00007fffe955d8d2 in std::_Function_handler<void (tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*), TVMFuncCreateFromCFunc::{lambda(tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*)#2}>::_M_invoke(std::_Any_data const&, tvm::runtime::TVMArgs&&, tvm::runtime::TVMRetValue*&&) () from /home/siju/.local/lib/python3.6/site-packages/tvm-0.5.dev0-py3.6-linux-x86_64.egg/tvm/libtvm.so
#8  0x00007fffe95a5fbc in tvm::runtime::RPCGetPath(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
   from /home/siju/.local/lib/python3.6/site-packages/tvm-0.5.dev0-py3.6-linux-x86_64.egg/tvm/libtvm.so
#9  0x00007fffe95a673d in std::_Function_handler<void (tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*), tvm::runtime::{lambda(tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*)#1}>::_M_invoke ()
   from /home/siju/.local/lib/python3.6/site-packages/tvm-0.5.dev0-py3.6-linux-x86_64.egg/tvm/libtvm.so
#10 0x00007fffe95a895b in tvm::runtime::RPCSession::EventHandler::HandlePackedCall() () from /home/siju/.local/lib/python3.6/site-packages/tvm-0.5.dev0-py3.6-linux-x86_64.egg/tvm/libtvm.so
#11 0x00007fffe95ae6fd in tvm::runtime::RPCSession::EventHandler::SwitchToState(tvm::runtime::RPCSession::EventHandler::State) ()
   from /home/siju/.local/lib/python3.6/site-packages/tvm-0.5.dev0-py3.6-linux-x86_64.egg/tvm/libtvm.so
#12 0x00007fffe95afae5 in tvm::runtime::RPCSession::EventHandler::HandleRecvPackedSeqArg() () from /home/siju/.local/lib/python3.6/site-packages/tvm-0.5.dev0-py3.6-linux-x86_64.egg/tvm/libtvm.so
#13 0x00007fffe95b0248 in tvm::runtime::RPCSession::EventHandler::HandleNextEvent(tvm::runtime::TVMRetValue*, bool, tvm::runtime::PackedFunc const*) ()
   from /home/siju/.local/lib/python3.6/site-packages/tvm-0.5.dev0-py3.6-linux-x86_64.egg/tvm/libtvm.so
#14 0x00007fffe95aa584 in tvm::runtime::RPCSession::HandleUntilReturnEvent(tvm::runtime::TVMRetValue*, bool, tvm::runtime::PackedFunc const*) ()
   from /home/siju/.local/lib/python3.6/site-packages/tvm-0.5.dev0-py3.6-linux-x86_64.egg/tvm/libtvm.so
#15 0x00007fffe95aa86d in tvm::runtime::RPCSession::ServerLoop() () from /home/siju/.local/lib/python3.6/site-packages/tvm-0.5.dev0-py3.6-linux-x86_64.egg/tvm/libtvm.so

Any idea why this is happening?

If you are trying to callback into python, be-aware that python may have GIL that locks things up