秋来冬风的博客

mmap_error

目录

Go1.21 forward-looking

Software translation

Windows allows handling exception page errors

Go1.21 is under development, draft release note Mention that it is expected to be released in August 2023

According to the submitted information runtime: Allow handling of EXCEPTION_IN_PAGE_ERROR Go1.21 allows you to handle the access failure of the memory-mapped file through debug.SetPanicOnFault in Windows (for example, the drive where the memory-mapped file is located is ejected)

For example, it comes from golang/go#58457 Example of

Memory mapping files on external disks (using CreateFileMapping/MapViewOfFile) Call debug. SetPanicOnFault (true) Eject external disk Attempt to read from memory map What do you see? The runtime faults (Exception 0xc0000006 0x0 …)

This is not a panic and cannot be recovered through recover

Go1.21 should be the panic

According to SetPanicOnFault document In this case, when debugging. SetPanicOnFault (true) is called, a program using a memory mapping file or an unsafe memory operation may cause a non-zero address error; SetPanicOnFault allows such a program to request to trigger panic only once when running. According to golang/go#58457 At least that was not the case in go1.19. As of the release, we did not see that the official go plans to reverse migrate the repair submission to the next minor version of go1.20 and go1.19

Tags: