Modify

Opened 9 years ago

Last modified 9 years ago

#3572 new Bugs

mapped_file: reading/writing mapped memory can throw (structured) exceptions? (windows)

Reported by: xurux1-mail@… Owned by: Jonathan Turkanis
Milestone: Boost 1.41.0 Component: iostreams
Version: Boost 1.40.0 Severity: Problem
Keywords: mapped_file, documentation Cc:

Description

msdn: "Reading and Writing From a File View" (http://msdn.microsoft.com/en-us/library/aa366801(VS.85).aspx)

"Reading from or writing to a file view can cause an EXCEPTION_IN_PAGE_ERROR exception. For example, accessing a mapped file that resides on a remote server can generate an exception if the connection to the server is lost. Exceptions can also occur because of a full disk, an underlying device failure, or a memory allocation failure. When writing to a file view, exceptions can also occur because the file is shared and a different process has locked a byte range. To guard against exceptions due to input and output (I/O) errors, all attempts to access memory mapped files should be wrapped in structured exception handlers"

DWORD dwLength; try {

dwLength = *((LPDWORD) lpMapAddress);

} except(GetExceptionCode?()==EXCEPTION_IN_PAGE_ERROR ?

EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH)

{

Failed to read from the view.

}

... so it should be mentioned in the documentation? (windows specific)

Attachments (0)

Change History (1)

comment:1 Changed 9 years ago by anonymous

interesting:

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6415680

java has a get method, to access bytes in a FileChannel? (=mmap'ed file), which should do the checking ...

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain Jonathan Turkanis.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.