Skip to content

tarpc make crash when c++ Destructor execute #449

@work-chausat

Description

@work-chausat

when c++ Destructor execute:

OpKernelRegistry::~OpKernelRegistry()
{
    const std::lock_guard<std::mutex> lk(mu_);
    for (auto &kernelsOfOp : kernels_) {
        ACL_LOG_DEBUG("To unregister kernel of op: %s", kernelsOfOp.first.c_str());
        for (auto &it : kernelsOfOp.second) {
            ACL_LOG_DEBUG("To unregister bin by handle: %p, kernelId = %s", it.second->binHandle, it.first.c_str());
            (void)rtDevBinaryUnRegister(it.second->binHandle);
        }
    }
}

thread '<unnamed>' panicked at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/thread/local.rs:262:26:
cannot access a Thread Local Storage value during or after destruction: AccessError
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::result::unwrap_failed
   3: thread_local::thread_id::get_slow
   4: <tracing_subscriber::registry::sharded::Registry as tracing_core::subscriber::Subscriber>::current_span
   5: <tracing_subscriber::fmt::Subscriber<N,E,F,W> as tracing_core::subscriber::Subscriber>::current_span
   6: tracing_core::dispatcher::get_default
   7: tracing::span::Span::current
   8: tarpc::context::Context::current
   9: tarpc::context::current
  10: rtDevBinaryUnRegister
  11: _ZN2ge12KernelHolderD1Ev
  12: _ZNSt8_Rb_treeISsSt4pairIKSsSt10unique_ptrIN2ge12KernelHolderESt14default_deleteIS4_EEESt10_Select1stIS8_ESt4lessISsESaIS8_EE8_M_eraseEPSt13_Rb_tree_nodeIS8_E
  13: __run_exit_handlers
             at /usr/src/debug/glibc-2.28/stdlib/exit.c:108:8
  14: __GI_exit
             at /usr/src/debug/glibc-2.28/stdlib/exit.c:139:3
  15: __libc_start_main
             at /usr/src/debug/glibc-2.28/csu/../csu/libc-start.c:348:3
  16: _start

tarpc paniced, other rpc framework has no this problem, how to solve it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions