Skip to content

runtime: fatal: cannot map pages in arena address space #19514

Closed
@mappu

Description

@mappu

What version of Go are you using (go version)?

go version go1.7.5 windows/amd64

What operating system and processor architecture are you using (go env)?

set GOARCH=amd64
set GOBIN=
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\DEV\_Gopath\
set GORACE=
set GOROOT=C:\Go
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set CC=gcc
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0
set CXX=g++
set CGO_ENABLED=1

What did you do?

Ran a bad program with a stack overflow.

What did you expect to see?

"error: Stack overflow" or "error: out of memory"

What did you see instead?

Process memory usage grows to about 4GB (this machine has 8GB physical) and then panics:

runtime: VirtualAlloc of 1048576 bytes failed with errno=1455
fatal error: runtime: cannot map pages in arena address space

runtime stack:
runtime.throw(0x50fb52, 0x30)
        c:/go/src/runtime/panic.go:566 +0x9c
runtime.sysMap(0xc136200000, 0x100000, 0x1, 0x5a8c98)
        c:/go/src/runtime/mem_windows.go:116 +0x12c
runtime.(*mheap).sysAlloc(0x58ff40, 0x100000, 0x58ff88)
        c:/go/src/runtime/malloc.go:407 +0x381
runtime.(*mheap).grow(0x58ff40, 0x29, 0x0)
        c:/go/src/runtime/mheap.go:726 +0x69
runtime.(*mheap).allocSpanLocked(0x58ff40, 0x29, 0xc04201c820)
        c:/go/src/runtime/mheap.go:630 +0x4f9
runtime.(*mheap).alloc_m(0x58ff40, 0x29, 0x100000000, 0x2a36c10)
        c:/go/src/runtime/mheap.go:515 +0xee
runtime.(*mheap).alloc.func1()
        c:/go/src/runtime/mheap.go:579 +0x52
runtime.systemstack(0x79fe68)
        c:/go/src/runtime/asm_amd64.s:314 +0xb5
runtime.(*mheap).alloc(0x58ff40, 0x29, 0x100000000, 0x2a36c10)
        c:/go/src/runtime/mheap.go:580 +0xa7
runtime.largeAlloc(0x515c8, 0x451c00, 0x2a36c10)
        c:/go/src/runtime/malloc.go:774 +0x9a
runtime.mallocgc.func1()
        c:/go/src/runtime/malloc.go:669 +0x45
runtime.systemstack(0xc042014000)
        c:/go/src/runtime/asm_amd64.s:298 +0x7e
runtime.mstart()
        c:/go/src/runtime/proc.go:1079

goroutine 1 [running]:
runtime.systemstack_switch()
        c:/go/src/runtime/asm_amd64.s:252 fp=0xc107e535e8 sp=0xc107e535e0
runtime.mallocgc(0x515c8, 0x0, 0x0, 0xc0414b7b23)
        c:/go/src/runtime/malloc.go:670 +0x94b fp=0xc107e53688 sp=0xc107e535e8
runtime.rawstring(0x515c8, 0x0, 0x0, 0x0, 0x0, 0x0)
        c:/go/src/runtime/string.go:289 +0x8c fp=0xc107e536c0 sp=0xc107e53688
runtime.rawstringtmp(0x0, 0x515c8, 0xc042010c00, 0xc107e53748, 0xc11790e000, 0x586f90, 0x500f40)
        c:/go/src/runtime/string.go:111 +0xa8 fp=0xc107e53700 sp=0xc107e536c0
runtime.slicebytetostring(0x0, 0xc11790e000, 0x515c8, 0x60000, 0x2, 0x2)
        c:/go/src/runtime/string.go:93 +0x45 fp=0xc107e53758 sp=0xc107e53700
fmt.Sprintf(0x50a41f, 0x11, 0xc107e538d0, 0x2, 0x2, 0x467ec0, 0xc04249e100)
        c:/go/src/fmt/print.go:197 +0x9d fp=0xc107e537b0 sp=0xc107e53758
my_application_code(0xc04225f720, 0xc1361a6000, 0x515ba, 0x2, 0xc042268480, 0x50e143, 0x21, 0xc107e539c0, 0x445312, 0x5782a8, ...)
        C:/my_application...

[same frame several hundred times]

...additional frames elided...

[no other goroutines running]

I acknowledge the underlying stack overflow is entirely my own fault. But, this kind of error message from the runtime is worrying. It reads as if the runtime attempted to do something invalid or dangerous, instead of intelligently handling the low-memory condition.

Is the runtime behaving correctly here? Is this the expected error message under memory pressure conditions?

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.OS-Windows

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions