google / google/tarpc

tarpc make crash when c++ Destructor execute

Open
#449 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
3.7k
Forks
230
PR merge metrics
No merged PRs in 30d

Description

when c++ Destructor execute:

```
OpKernelRegistry::~OpKernelRegistry()
{
const std::lock_guard 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 '' 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: ::current_span
5: 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?**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.