Re: [Boost-bugs] [Boost C++ Libraries] #12659: Deadlocked with boost::interprocess::managed_mapped_file find

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #12659: Deadlocked with boost::interprocess::managed_mapped_file find
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2018-07-26 08:38:37


#12659: Deadlocked with boost::interprocess::managed_mapped_file find
-------------------------------+---------------------------
  Reporter: soumyadutta13@… | Owner: Ion Gaztañaga
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: interprocess
   Version: Boost 1.61.0 | Severity: Problem
Resolution: | Keywords:
-------------------------------+---------------------------

Comment (by windjianlipf@…):

 Replying to [comment:2 Ion Gaztañaga]:
> I can't reproduce the problem, could you provide a small compilable test
 case?

 I am suffering from this problem too.

 The code halts at the lock.
 {{{
 (gdb) info threads
   Id Target Id Frame
 * 1 Thread 0x7ffff7fcb740 (LWP 15189) "test_mmap" __lll_lock_wait () at
 ../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135
 (gdb) bt
 #0 __lll_lock_wait () at
 ../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135
 #1 0x00007ffff7bc3e42 in __GI___pthread_mutex_lock (mutex=0x7ffff6df0070)
 at ../nptl/pthread_mutex_lock.c:115
 #2 0x000000000040286f in
 boost::interprocess::ipcdetail::posix_recursive_mutex::lock
 (this=0x7ffff6df0070)
     at
 thirdparty/boost-1.66.0/include/boost/interprocess/sync/posix/recursive_mutex.hpp:90
 #3 boost::interprocess::interprocess_recursive_mutex::lock
 (this=0x7ffff6df0070)
     at
 thirdparty/boost-1.66.0/include/boost/interprocess/sync/interprocess_recursive_mutex.hpp:163
 #4
 boost::interprocess::scoped_lock<boost::interprocess::interprocess_recursive_mutex>::lock
 (this=<synthetic pointer>)
     at
 thirdparty/boost-1.66.0/include/boost/interprocess/sync/scoped_lock.hpp:284
 #5 boost::interprocess::segment_manager<char,
 boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family,
 boost::interprocess::offset_ptr<void, long, unsigned long, 0ul>, 0ul>,
 boost::interprocess::iset_index>::priv_get_lock (use_lock=true,
     this=0x7ffff6df0010) at
 thirdparty/boost-1.66.0/include/boost/interprocess/segment_manager.hpp:1315

 }}}

 {{{
 (gdb) f 1
 #1 0x00007ffff7bc3e42 in __GI___pthread_mutex_lock (mutex=0x7ffff6df0070)
 at ../nptl/pthread_mutex_lock.c:115
 115 ../nptl/pthread_mutex_lock.c: 没有那个文件或目录.
 (gdb) p *mutex
 $1 = {__data = {__lock = 2, __count = 2, __owner = 19759, __nusers = 1,
 __kind = 129, __spins = 0, __elision = 0, __list = {
       __prev = 0x0, __next = 0x0}},
   __size =
 "\002\000\000\000\002\000\000\000/M\000\000\001\000\000\000\201", '\000'
 <repeats 22 times>, __align = 8589934594}
 }}}

 It's a single-threaded program, however the mutex infomation shows the
 owner is 19759.

 I'm using boost-1.66.0.

 Here is my test code. The file exceeds the limit, Can I email you?

 {{{
 #include <iostream>
 #include <boost/interprocess/managed_mapped_file.hpp>
 #include <boost/interprocess/allocators/allocator.hpp>
 #include <boost/interprocess/containers/string.hpp>

 namespace bip = ::boost::interprocess;
 using SegmentManager = bip::managed_mapped_file::segment_manager;
 using Allocator = bip::allocator<char, SegmentManager>;
 using String = bip::basic_string<char, std::char_traits<char>, Allocator>;

 int main() {
   auto segment = std::make_shared<bip::managed_mapped_file>(
         bip::open_or_create, "./test_mmap", 1024*1024*10);
   (*segment).template find<String>("test");
   std::cout << "find" << std::endl;
   return 0;
 }
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac10/ticket/12659#comment:3>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2018-07-26 08:43:43 UTC