简体   繁体   English

访问thread_data_base的偏移量时,在pthread_join上增强线程连接段错误

[英]Boost thread join seg fault on pthread_join while accessing an offset from thread_data_base

Crash is seen when pthread code tries to access an offset from thread_handle
#0  0x00007f6c7459b7d8 in pthread_join () from /lib64/libpthread.so.0
#1  0x00007f6c7438c310 in boost::thread::join (this=0x4069ef0)

Here is the thread info from object (this=0x4069ef0):

$14 = (boost::detail::thread_data_base *) 0x3c2fd90
(gdb) p  *$9.px
$15 = {
  <boost::enable_shared_from_this<boost::detail::thread_data_base>> = {
    weak_this_ = {
      px = 0x3c2fd90,
      pn = {
        pi_ = 0x3c2ff20
      }
    }
  },
  members of boost::detail::thread_data_base:
  _vptr.thread_data_base = 0x102c3f0,
  self = {
    px = 0x0,
    pn = {
      pi_ = 0x0
    }
  },
  thread_handle = 140103459141968,

Accessing contents from thread_handle causing segfault. 从thread_handle访问内容会导致segfault。 On trying to view contents from *thread_handle 关于尝试从* thread_handle查看内容

Cannot access memory at address 0x7f6c60e9f950 无法访问地址0x7f6c60e9f950的内存

Boost version is boost-1.41.0 Boost版本是boost-1.41.0

Here is the code which creates the thread 这是创建线程的代码

t1 = new boost::thread(boost::bind(&test::Th, this));

Later while cleanup 稍后清理时

t1->join();

cause seg fault 导致段故障

We had some code which was intercepting pthreads and releasing the stack allocated by using pthread api. 我们有一些代码可以拦截pthread并释放使用pthread api分配的堆栈。 Later when boost was accessing the it as the stack was gone we were seeing issue. 后来,当堆栈消失时,boost访问它时,我们看到了问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM