Random crash when running simple 'Hello World' style program

Hey all,

This has been happening since Go 1.15.3 (which is when I first started using Go), and I just updated to 1.15.6 today and still encounter the same bug.

First, here’s the code:

package main

import "fmt"

func main() {
	fmt.Println("This worked!")
}

It seems simple, right? What could possibly go wrong? And 19/20 it doesn’t go wrong for me. But 1/20 it does - and I get something similar to the following call stack:

test.exe
Exception 0xc0000005 0x0 0x7ffa8e4f0fff 0x1ecead80000
PC=0x1ecead80000

runtime: unknown pc 0x1ecead80000
stack: frame={sp:0xc8fe1fe060, fp:0x0} stack=[0x0,0xc8fe1ff740)
000000c8fe1fdf60:  000000c8fe1fdfa8  000000c8fe1fdfd0
000000c8fe1fdf70:  000000c8fe1fdf98  000000c8fe1fdf90
000000c8fe1fdf80:  000000c8fe1fdf94  000001ece4280000
000000c8fe1fdf90:  0000000000000000  0000000000000000
000000c8fe1fdfa0:  0000000000000000  0000000000000005
000000c8fe1fdfb0:  000000c8fe1fe0f8  00007ffa8be3a2c5
000000c8fe1fdfc0:  000001ece40129a0  00007ffa8e3146ce
000000c8fe1fdfd0:  00007ffa8e2f00e8  000001ece404f3f0
000000c8fe1fdfe0:  00007ffa8be3a2bf  000000c8fe1fe030
000000c8fe1fdff0:  004f0044004e0049  0053005c00530057
000000c8fe1fe000:  000001ece40129a0  0000000000000000
000000c8fe1fe010:  000001ece403ed90  006c006400050005
000000c8fe1fe020:  00007ffa8be3a2bf  0000000000000000
000000c8fe1fe030:  00007ffa00000000  00007ffa8e2f00e8
000000c8fe1fe040:  0000000000000000  0000000000000000
000000c8fe1fe050:  0000000000000001  00007ffa8e313783
000000c8fe1fe060: <000001ec00000001  0000000000000000
000000c8fe1fe070:  0000000000000000  000000c8fe1fe168
000000c8fe1fe080:  0000000000000000  0000000000000000
000000c8fe1fe090:  0000000000000000  0000000000000000
000000c8fe1fe0a0:  000001ece404f3f0  00007ffa8e4412a0
000000c8fe1fe0b0:  000001ece40129a0  00007ffa8e4438c0
000000c8fe1fe0c0:  000000000000097d  00007ffa8aeaccd8
000000c8fe1fe0d0:  00007ffa8aeaa148  00007ffa8e4412c8
000000c8fe1fe0e0:  00007ffa8e4540ef  00007ffa8aea0000
000000c8fe1fe0f0:  00007ffa8e445eb4  00007ffa8e370c40
000000c8fe1fe100:  0000000000000000  0000000000000000
000000c8fe1fe110:  0000000000000000  0000000000000000
000000c8fe1fe120:  000001ece4050360  0000000000000040
000000c8fe1fe130:  0000000000000003  00007ffa8e45b3f0
000000c8fe1fe140:  0000000000000001  000000c8fe1fe400
000000c8fe1fe150:  000001ece403ed90  00007ffa8e351568
runtime: unknown pc 0x1ecead80000
stack: frame={sp:0xc8fe1fe060, fp:0x0} stack=[0x0,0xc8fe1ff740)
000000c8fe1fdf60:  000000c8fe1fdfa8  000000c8fe1fdfd0
000000c8fe1fdf70:  000000c8fe1fdf98  000000c8fe1fdf90
000000c8fe1fdf80:  000000c8fe1fdf94  000001ece4280000
000000c8fe1fdf90:  0000000000000000  0000000000000000
000000c8fe1fdfa0:  0000000000000000  0000000000000005
000000c8fe1fdfb0:  000000c8fe1fe0f8  00007ffa8be3a2c5
000000c8fe1fdfc0:  000001ece40129a0  00007ffa8e3146ce
000000c8fe1fdfd0:  00007ffa8e2f00e8  000001ece404f3f0
000000c8fe1fdfe0:  00007ffa8be3a2bf  000000c8fe1fe030
000000c8fe1fdff0:  004f0044004e0049  0053005c00530057
000000c8fe1fe000:  000001ece40129a0  0000000000000000
000000c8fe1fe010:  000001ece403ed90  006c006400050005
000000c8fe1fe020:  00007ffa8be3a2bf  0000000000000000
000000c8fe1fe030:  00007ffa00000000  00007ffa8e2f00e8
000000c8fe1fe040:  0000000000000000  0000000000000000
000000c8fe1fe050:  0000000000000001  00007ffa8e313783
000000c8fe1fe060: <000001ec00000001  0000000000000000
000000c8fe1fe070:  0000000000000000  000000c8fe1fe168
000000c8fe1fe080:  0000000000000000  0000000000000000
000000c8fe1fe090:  0000000000000000  0000000000000000
000000c8fe1fe0a0:  000001ece404f3f0  00007ffa8e4412a0
000000c8fe1fe0b0:  000001ece40129a0  00007ffa8e4438c0
000000c8fe1fe0c0:  000000000000097d  00007ffa8aeaccd8
000000c8fe1fe0d0:  00007ffa8aeaa148  00007ffa8e4412c8
000000c8fe1fe0e0:  00007ffa8e4540ef  00007ffa8aea0000
000000c8fe1fe0f0:  00007ffa8e445eb4  00007ffa8e370c40
000000c8fe1fe100:  0000000000000000  0000000000000000
000000c8fe1fe110:  0000000000000000  0000000000000000
000000c8fe1fe120:  000001ece4050360  0000000000000040
000000c8fe1fe130:  0000000000000003  00007ffa8e45b3f0
000000c8fe1fe140:  0000000000000001  000000c8fe1fe400
000000c8fe1fe150:  000001ece403ed90  00007ffa8e351568
rax     0x7ffa8aead87c
rbx     0x7ffa8aead87a
rcx     0x41
rdi     0xffffffffffbadd11
rsi     0x0
rbp     0x7ffa8b04a100
rsp     0xc8fe1fe060
r8      0x0
r9      0x0
r10     0x0
r11     0x97c
r12     0xc000007a
r13     0x0
r14     0x7ffa8aead87c
r15     0x7ffa8e2f0000
rip     0x1ecead80000
rflags  0x10202
cs      0x33
fs      0x53
gs      0x2b

…at first I thought it was something to do with the built executable, but I’m also able to repeat this behavior using Go itself:

go run test.go
Exception 0xc0000005 0x0 0x7ffa8e4f0fff 0x153a8980000
PC=0x153a8980000

runtime: unknown pc 0x153a8980000
stack: frame={sp:0x31ec1fe3a0, fp:0x0} stack=[0x0,0x31ec1ffa80)
00000031ec1fe2a0:  00000031ec1fe2e8  00000031ec1fe310
00000031ec1fe2b0:  00000031ec1fe2d8  00000031ec1fe2d0
00000031ec1fe2c0:  00000031ec1fe2d4  0000015383670000
00000031ec1fe2d0:  0000000000000000  0000000000000000
00000031ec1fe2e0:  0000000000000000  0000000000000005
00000031ec1fe2f0:  00000031ec1fe438  00007ffa8be3a2c5
00000031ec1fe300:  0000015383422ab0  00007ffa8e3146ce
00000031ec1fe310:  00007ffa8e2f00e8  0000015383456290
00000031ec1fe320:  00007ffa8be3a2bf  00000031ec1fe370
00000031ec1fe330:  004f0044004e0049  0053005c00530057
00000031ec1fe340:  0000015383422ab0  0000000000000000
00000031ec1fe350:  000001538343d8f0  006c006400050005
00000031ec1fe360:  00007ffa8be3a2bf  0000000000000000
00000031ec1fe370:  00007ffa00000000  00007ffa8e2f00e8
00000031ec1fe380:  0000000000000000  0000000000000000
00000031ec1fe390:  0000000000000001  00007ffa8e313783
00000031ec1fe3a0: <0000015300000001  0000000000000000
00000031ec1fe3b0:  0000000000000000  00000031ec1fe4a8
00000031ec1fe3c0:  0000000000000000  0000000000000000
00000031ec1fe3d0:  0000000000000000  0000000000000000
00000031ec1fe3e0:  0000015383456290  00007ffa8e4412a0
00000031ec1fe3f0:  0000015383422ab0  00007ffa8e4438c0
00000031ec1fe400:  000000000000097d  00007ffa8aeaccd8
00000031ec1fe410:  00007ffa8aeaa148  00007ffa8e4412c8
00000031ec1fe420:  00007ffa8e4540ef  00007ffa8aea0000
00000031ec1fe430:  00007ffa8e445eb4  00007ffa8e370c40
00000031ec1fe440:  0000000000000000  0000000000000000
00000031ec1fe450:  0000000000000000  0000000000000000
00000031ec1fe460:  00000153834515c0  0000000000000040
00000031ec1fe470:  0000000000000003  00007ffa8e45b3f0
00000031ec1fe480:  0000000000000001  00000031ec1fe700
00000031ec1fe490:  000001538343d8f0  00007ffa8e351568
runtime: unknown pc 0x153a8980000
stack: frame={sp:0x31ec1fe3a0, fp:0x0} stack=[0x0,0x31ec1ffa80)
00000031ec1fe2a0:  00000031ec1fe2e8  00000031ec1fe310
00000031ec1fe2b0:  00000031ec1fe2d8  00000031ec1fe2d0
00000031ec1fe2c0:  00000031ec1fe2d4  0000015383670000
00000031ec1fe2d0:  0000000000000000  0000000000000000
00000031ec1fe2e0:  0000000000000000  0000000000000005
00000031ec1fe2f0:  00000031ec1fe438  00007ffa8be3a2c5
00000031ec1fe300:  0000015383422ab0  00007ffa8e3146ce
00000031ec1fe310:  00007ffa8e2f00e8  0000015383456290
00000031ec1fe320:  00007ffa8be3a2bf  00000031ec1fe370
00000031ec1fe330:  004f0044004e0049  0053005c00530057
00000031ec1fe340:  0000015383422ab0  0000000000000000
00000031ec1fe350:  000001538343d8f0  006c006400050005
00000031ec1fe360:  00007ffa8be3a2bf  0000000000000000
00000031ec1fe370:  00007ffa00000000  00007ffa8e2f00e8
00000031ec1fe380:  0000000000000000  0000000000000000
00000031ec1fe390:  0000000000000001  00007ffa8e313783
00000031ec1fe3a0: <0000015300000001  0000000000000000
00000031ec1fe3b0:  0000000000000000  00000031ec1fe4a8
00000031ec1fe3c0:  0000000000000000  0000000000000000
00000031ec1fe3d0:  0000000000000000  0000000000000000
00000031ec1fe3e0:  0000015383456290  00007ffa8e4412a0
00000031ec1fe3f0:  0000015383422ab0  00007ffa8e4438c0
00000031ec1fe400:  000000000000097d  00007ffa8aeaccd8
00000031ec1fe410:  00007ffa8aeaa148  00007ffa8e4412c8
00000031ec1fe420:  00007ffa8e4540ef  00007ffa8aea0000
00000031ec1fe430:  00007ffa8e445eb4  00007ffa8e370c40
00000031ec1fe440:  0000000000000000  0000000000000000
00000031ec1fe450:  0000000000000000  0000000000000000
00000031ec1fe460:  00000153834515c0  0000000000000040
00000031ec1fe470:  0000000000000003  00007ffa8e45b3f0
00000031ec1fe480:  0000000000000001  00000031ec1fe700
00000031ec1fe490:  000001538343d8f0  00007ffa8e351568
rax     0x7ffa8aead87c
rbx     0x7ffa8aead87a
rcx     0x41
rdi     0xffffffffffbadd11
rsi     0x0
rbp     0x7ffa8b04a100
rsp     0x31ec1fe3a0
r8      0x0
r9      0x0
r10     0x0
r11     0x97c
r12     0xc000007a
r13     0x0
r14     0x7ffa8aead87c
r15     0x7ffa8e2f0000
rip     0x153a8980000
rflags  0x10202
cs      0x33
fs      0x53
gs      0x2b

This is on Windows 10 using Go 1.15.3 and now using Go 1.15.6. It’s unfortunate that it’s a random crash, but I’d be happy to investigate - I’m just not sure where to begin. Any suggestions would be gratefully accepted!

Maybe this helps: