Boost logo

Boost :

Subject: Re: [boost] [interprocess] Arithmetic error
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-01-16 19:00:28


AMDG

Henrik Sundberg wrote:
> Disclaimer: I have no minimal reproducing program.
>
> The problem occurs at line 458 in mapped_region.hpp:
> 456 //We calculate the difference between demanded and valid offset
> 457 std::size_t page_size = this->get_page_size();
> 458 m_extra_offset = (offset - (offset / page_size) * page_size);
>
> I've found out that page_size gets the value 0. It only seems to
> happen in my single core computer. It works for other Kubuntu 8.10
> systems.
>
> The code is needed during so-load. The library is used from two other
> libraries that are loaded by the program (like a diamond library
> load).
>
> I've been discussing the problem in this forum:
> http://www.safirsdk.com/forum/phpBB3/viewtopic.php?f=4&t=61
>
> The code is open (available from the site of the forum). It is a whole
> framework though, not just a small program.
>
> I don't know if this is a compiler bug, a Boost bug or a bug in the program.
> I think that the page size is supposed to be cached, but that this
> somehow doesn't happen in this setup. I get the error every time.
> Preloading the library avoids the problem. I.e. starting like this
> works: LD_PRELOAD=libdots_kernel.so dobexplorer
>

This is a Boost.Interprocess bug. It has been fixed in the trunk.
You can either patch 1.35 by changing line 531 ff. from

inline std::size_t mapped_region::get_page_size()
{ return page_size_holder<0>::PageSize; }

to

inline std::size_t mapped_region::get_page_size()
{
   if(!page_size_holder<0>::PageSize)
      return page_size_holder<0>::get_page_size();
   else
      return page_size_holder<0>::PageSize;
}

In Christ,
Steven Watanabe


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk