Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime: VirtualAlloc of 0 bytes failed with errno=1455 #33716

ayanamist opened this issue Aug 19, 2019 · 8 comments

runtime: VirtualAlloc of 0 bytes failed with errno=1455 #33716

ayanamist opened this issue Aug 19, 2019 · 8 comments


Copy link

@ayanamist ayanamist commented Aug 19, 2019

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

$ go version
go version go1.12.9 windows/amd64

Does this issue reproduce with the latest release?


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

go env Output
$ go env
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\ayanamist\AppData\Local\go-build
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Users\ayanamist\Documents\Projects
set GOROOT=c:\go
set GOTOOLDIR=c:\go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set GOMOD=
set CGO_CFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\AYANAM~1\AppData\Local\Temp\go-build065836494=/tmp/go-build -gno-record-gcc-switches

What did you do?

My quite complex proxy program

What did you expect to see?

Works fine

What did you see instead?

runtime: VirtualAlloc of 0 bytes failed with errno=1455
fatal error: runtime: failed to commit pages

runtime stack:
runtime.throw(0x8d1d68, 0x1f)
        c:/go/src/runtime/panic.go:617 +0x79
runtime.sysUsed(0xc0046ae000, 0x18000)
        c:/go/src/runtime/mem_windows.go:77 +0x198
runtime.(*mheap).allocSpanLocked(0xc87fe0, 0xc, 0xca2028, 0x203001100000000)
        c:/go/src/runtime/mheap.go:1199 +0x146
runtime.(*mheap).alloc_m(0xc87fe0, 0xc, 0x101, 0x155ffff)
        c:/go/src/runtime/mheap.go:977 +0xd0
        c:/go/src/runtime/mheap.go:1048 +0x53
runtime.(*mheap).alloc(0xc87fe0, 0xc, 0x1000101, 0x4d6eee0)
        c:/go/src/runtime/mheap.go:1047 +0x91
runtime.largeAlloc(0x16184, 0x450100, 0x4d6eee0)
        c:/go/src/runtime/malloc.go:1055 +0xa0
        c:/go/src/runtime/malloc.go:950 +0x4d
        c:/go/src/runtime/asm_amd64.s:351 +0x6b

Full stacks see attachment stack.txt

Copy link

@agnivade agnivade commented Aug 19, 2019

Does this happen with 1.13beta1 too ? Is there a way you can give us a short program which causes this behavior ?

@aclements @mknyszek

@agnivade agnivade added this to the Go1.14 milestone Aug 19, 2019
Copy link

@ayanamist ayanamist commented Aug 19, 2019

I will try 1.13 beta1. I cant give a short lrogram, since it needs a long time running before it occurs. It runs from 1.12.9 released until few minutes before i post this issue. But it occured several times before 1.12.9 released without my attention.

Copy link

@mknyszek mknyszek commented Aug 19, 2019

The errno=1455 indicates that this is ERROR_COMMITMENT_LIMIT which is a type of out-of-memory failure on Windows. On tip this is correctly reported as "out of memory" instead of "failed to commit pages" by the runtime as a result of some of the work done in malloc.go done in Go 1.13.

It's also possible that for your application an out-of-memory condition is also less likely in Go 1.13, since we now return memory to the OS much more aggressively (#30333).

@ayanamist Let me know how running with the Go 1.13 beta1 goes!

Copy link

@ayanamist ayanamist commented Aug 19, 2019

This feature seems amazing, i must try 1.13beta1

@rsc rsc modified the milestones: Go1.14, Backlog Oct 9, 2019
Copy link

@glycerine glycerine commented Feb 4, 2020

I just encountered a similar panic. I am running Go 1.13.4 windows/amd64. My windows VM has 5GB of RAM. Go tried to allocate 4GB of ram and crashed. This is a big long running program (had been running for about 24 hours at the point of crash) so no easy repro test case available immediately.

runtime: VirtualAlloc of 4294967296 bytes failed with errno=1455
fatal error: out of memory

runtime stack:
runtime.throw(0x2977e71, 0xd)
        c:/go/src/runtime/panic.go:774 +0x79
runtime.sysUsed(0xc280b26000, 0x100000000)
        c:/go/src/runtime/mem_windows.go:83 +0x230
runtime.(*mheap).allocSpanLocked(0x4087660, 0x80000, 0x40ab448, 0x1210fda0)
        c:/go/src/runtime/mheap.go:1228 +0x203
runtime.(*mheap).alloc_m(0x4087660, 0x80000, 0x101, 0x1210fdd0)
        c:/go/src/runtime/mheap.go:1022 +0xd0
        c:/go/src/runtime/mheap.go:1093 +0x53
runtime.(*mheap).alloc(0x4087660, 0x80000, 0x10101, 0xc000048000)
        c:/go/src/runtime/mheap.go:1092 +0x91
runtime.largeAlloc(0xfffffe00, 0xc000040101, 0xc000056000)
        c:/go/src/runtime/malloc.go:1138 +0x9e
        c:/go/src/runtime/malloc.go:1033 +0x4d
        c:/go/src/runtime/asm_amd64.s:370 +0x6b

goroutine 1 [running]:
        c:/go/src/runtime/asm_amd64.s:330 fp=0xc0003e9108 sp=0xc0003e9100 pc=0x464f10
runtime.mallocgc(0xfffffe00, 0x26064a0, 0x1, 0xc0003e91d0)
        c:/go/src/runtime/malloc.go:1032 +0x8d4 fp=0xc0003e91a8 sp=0xc0003e9108 pc=0x411344
runtime.makeslice(0x26064a0, 0xfffffe00, 0xfffffe00, 0x0)
        c:/go/src/runtime/slice.go:49 +0x73 fp=0xc0003e91d8 sp=0xc0003e91a8 pc=0x44c4b3
bytes.makeSlice(0xfffffe00, 0x0, 0x0, 0x0)
        c:/go/src/bytes/buffer.go:229 +0x7e fp=0xc0003e9240 sp=0xc0003e91d8 pc=0x535c2e
bytes.(*Buffer).grow(0xc0003e9368, 0x200, 0x40000000)
        c:/go/src/bytes/buffer.go:142 +0x162 fp=0xc0003e9290 sp=0xc0003e9240 pc=0x535562
bytes.(*Buffer).ReadFrom(0xc0003e9368, 0x2e01ce0, 0xc0000060e0, 0x2917ea0, 0xc00006e120, 0xc0001\
        c:/go/src/bytes/buffer.go:202 +0x52 fp=0xc0003e9300 sp=0xc0003e9290 pc=0x535a12
io/ioutil.readAll(0x2e01ce0, 0xc0000060e0, 0x200, 0x0, 0x0, 0x0, 0x0, 0x0)
        c:/go/src/io/ioutil/ioutil.go:36 +0x107 fp=0xc0003e93a0 sp=0xc0003e9300 pc=0x54c927
Copy link

@glycerine glycerine commented Feb 4, 2020

they are probably distinct, so I opened as separate issue #37029

Copy link

@mknyszek mknyszek commented Feb 4, 2020

@glycerine AFAICT your application ran out of memory. It looks like your application tried to read more than 4 GiB from an io.Reader and the OS determined it didn't have enough memory left to satisfy the allocation (note that the bytes.Buffer grows, calling makeSlice with an argument of 4294966784 bytes, which was then rounded up to 4 GiB even because it's allocating at a page granularity).

Copy link

@ayanamist ayanamist commented Feb 5, 2020

@glycerine I solved issue by increase swap size. Before i only set 2GB swap, now i let windows manage it (

@ayanamist ayanamist closed this Feb 5, 2020
@golang golang locked and limited conversation to collaborators Feb 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants