Subject: Re: [Boost-bugs] [Boost C++ Libraries] #8945: managed_shared_memory::find assertion
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-02-12 05:32:15
#8945: managed_shared_memory::find assertion
-------------------------------+--------------------------
Reporter: bersac_1@⦠| Owner: igaztanaga
Type: Support Requests | Status: new
Milestone: To Be Determined | Component: interprocess
Version: Boost 1.54.0 | Severity: Problem
Resolution: | Keywords:
-------------------------------+--------------------------
Comment (by anonymous):
I can reproduce this issue consistently on CentOS 6.3 and 6.4 with Boost
1.59. Here's a program that exhibits such behavior (notice the type
mismatch between `construct` and `find`):
{{{
#include <boost/interprocess/managed_shared_memory.hpp>
int main() {
using namespace boost::interprocess;
auto segment = managed_shared_memory(open_or_create, "my_segment",
4096);
segment.construct<char>("key")();
segment.find<int>("key");
}
}}}
On the first run, it crashes with:
''/redacted/boost/interprocess/segment_manager.hpp:861:void*
boost::interprocess::segment_manager<CharType, MemoryAlgorithm,
IndexType>::priv_generic_find(const CharT*,
IndexType<boost::interprocess::ipcdetail::index_config<CharT,
MemoryAlgorithm> >&, boost::interprocess::ipcdetail::in_place_interface&,
boost::interprocess::segment_manager<CharType, MemoryAlgorithm,
IndexType>::size_type&, boost::interprocess::ipcdetail::true_, bool) [with
CharT = char; CharType = char; MemoryAlgorithm =
boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family>;
IndexType = boost::interprocess::iset_index;
boost::interprocess::segment_manager<CharType, MemoryAlgorithm,
IndexType>::size_type = long unsigned int;
boost::interprocess::ipcdetail::true_ =
boost::interprocess::ipcdetail::bool_<true>]: Assertion
`(ctrl_data->m_value_bytes % table.size) == 0' failed.
Aborted (core dumped)
''
On the second run, it deadlocks with the following `strace` output:
{{{
open("/dev/shm/my_segment", O_RDWR|O_NOFOLLOW|O_CLOEXEC) = 3
fcntl(3, F_GETFD) = 0x1 (flags FD_CLOEXEC)
fstat(3, {st_mode=S_IFREG|0644, st_size=4096, ...}) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=4096, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, 3, 0) = 0x7f1ae837e000
close(3) = 0
futex(0x7f1ae837e070, FUTEX_WAIT, 2, NULL
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/8945#comment:6> 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 : 2017-02-16 18:50:19 UTC