Opened 10 years ago

Last modified 10 years ago

#7235 new Bugs

mapped_region not accepting size = 0

Reported by: matthieu.dorier@… Owned by: Ion Gaztañaga
Milestone: To Be Determined Component: interprocess
Version: Boost 1.50.0 Severity: Problem
Keywords: mmap Cc:

Description

Since Linux 2.6.12, and on other platforms, mmap is supposed to fail if the specified "size" parameter is 0. This causes some problems in all the Boost.Interprocess library since pretty much all the high-level structures (managed_shared_memory, for instance) use mapped_region (thus mmap) with size = 0, usually when the object is created with the "open_only" flag.

I have observed this bug on BlueGene/P's CNK environment, with gcc 4.1.2. It seems logical to me that, when opening an existing shared structure, the size doesn't have to be known. I don't have any solution yet...

Change History (2)

comment:1 by Ion Gaztañaga, 10 years ago

AFAIK, when mapped_region is called iwth size = 0 the file descriptor is fstat-ed to obtain the size of the device and mmap is called with this size. Could you debug a bit more to make sure that's the problem? Thanks

comment:2 by matthieu.dorier@…, 10 years ago

Indeed you're right: fstat is the call that fails. When I pass the file descriptor of a shared memory object opened with shm_open, I get the error "Value too large for defined data type" (even though the size of the segment is only about 2500 bytes).

If I understand the documentation of BlueGene/P, the filesystems functions (such as fstat) are all redirected to the parallel filesystem on remote nodes, without checking if the file descriptor corresponds to something local (such as a file in /dev/shm), which may explain why the call fails.

Note: See TracTickets for help on using tickets.