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

Panic with"fatal error: invalid pointer found on stack" #4

Closed
Tnze opened this issue Apr 9, 2020 · 9 comments
Closed

Panic with"fatal error: invalid pointer found on stack" #4

Tnze opened this issue Apr 9, 2020 · 9 comments

Comments

@Tnze
Copy link

Tnze commented Apr 9, 2020

Hey, I am using logrus logging library. After I call logrus.Infof(), it panic. I have no idea what's happen. And this is the output:

runtime: bad pointer in frame github.com/konsorten/go-windows-terminal-sequences.EnableVirtualTerminalProcessing at 0xc000b67510: 0x1c4
fatal error: invalid pointer found on stack

runtime stack:
runtime.throw(0x717e6a, 0x1e)
        C:/Go/src/runtime/panic.go:1114 +0x79 fp=0x279cf7b8 sp=0x279cf788 pc=0x435af9
runtime.adjustpointers(0xc000b67510, 0x279cf8b8, 0x279cfc48, 0xb2ad00, 0xb3f0a0)
        C:/Go/src/runtime/stack.go:599 +0x22e fp=0x279cf818 sp=0x279cf7b8 pc=0x44ad0e
runtime.adjustframe(0x279cfb58, 0x279cfc48, 0xb3f0a0)
        C:/Go/src/runtime/stack.go:641 +0x355 fp=0x279cf8e8 sp=0x279cf818 pc=0x44b075
runtime.gentraceback(0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0xc000084c00, 0x0, 0x0, 0x7fffffff, 0x9479e8, 0x279cfc48, 0x0, ...)
        C:/Go/src/runtime/traceback.go:334 +0x111c fp=0x279cfbc0 sp=0x279cf8e8 pc=0x45717c
runtime.copystack(0xc000084c00, 0x4000)
        C:/Go/src/runtime/stack.go:888 +0x298 fp=0x279cfd78 sp=0x279cfbc0 pc=0x44b798
runtime.newstack()
        C:/Go/src/runtime/stack.go:1043 +0x219 fp=0x279cff08 sp=0x279cfd78 pc=0x44ba69
runtime.morestack()
        C:/Go/src/runtime/asm_amd64.s:449 +0x97 fp=0x279cff10 sp=0x279cff08 pc=0x4604c7

goroutine 15 [copystack]:
syscall.LoadDLL(0x71081a, 0xc, 0xc000a993e8, 0x43f9b3, 0xc000084c00)
        C:/Go/src/syscall/dll_windows.go:68 +0x40b fp=0xc000b673a8 sp=0xc000b673a0 pc=0x49f8ab
syscall.(*LazyDLL).Load(0xc0000ef160, 0x0, 0x0)
        C:/Go/src/syscall/dll_windows.go:236 +0xc7 fp=0xc000b673f8 sp=0xc000b673a8 pc=0x4a1207
syscall.(*LazyProc).Find(0xc000f81350, 0x0, 0x0)
        C:/Go/src/syscall/dll_windows.go:291 +0xbe fp=0xc000b67450 sp=0xc000b673f8 pc=0x4a147e
syscall.(*LazyProc).mustFind(0xc000f81350)
        C:/Go/src/syscall/dll_windows.go:309 +0x32 fp=0xc000b67478 sp=0xc000b67450 pc=0x4a15a2
syscall.(*LazyProc).Call(0xc000f81350, 0xc000b5c2a0, 0x2, 0x2, 0x947d30, 0xc000a99548, 0x4a5136, 0x7ff962d12820)
        C:/Go/src/syscall/dll_windows.go:327 +0x36 fp=0xc000b674c8 sp=0xc000b67478 pc=0x4a1676
github.com/konsorten/go-windows-terminal-sequences.EnableVirtualTerminalProcessing(0x1c4, 0x1, 0x0, 0xc000a9957c)
        C:/Users/Tnze/go/pkg/mod/github.com/konsorten/[email protected]/sequences.go:30 +0xcb fp=0xc000b67528 sp=0xc000b674c8 pc=0x67618b
github.com/sirupsen/logrus.initTerminal(0x996520, 0xc0000cc010)
        C:/Users/Tnze/go/pkg/mod/github.com/sirupsen/[email protected]/terminal_check_windows.go:16 +0x64 fp=0xc000b67558 sp=0xc000b67528 pc=0x678fd4
github.com/sirupsen/logrus.checkIfTerminal(0x996520, 0xc0000cc010, 0x710ac6)
        C:/Users/Tnze/go/pkg/mod/github.com/sirupsen/[email protected]/terminal_check_windows.go:31 +0xb4 fp=0xc000b67590 sp=0xc000b67558 pc=0x6790b4
github.com/sirupsen/logrus.(*TextFormatter).init(0xc00005c3c0, 0xc0000da1c0)
        C:/Users/Tnze/go/pkg/mod/github.com/sirupsen/[email protected]/text_formatter.go:98 +0x145 fp=0xc000b67628 sp=0xc000b67590 pc=0x6792a5
github.com/sirupsen/logrus.(*TextFormatter).Format.func1()
        C:/Users/Tnze/go/pkg/mod/github.com/sirupsen/[email protected]/text_formatter.go:188 +0x3a fp=0xc000b67648 sp=0xc000b67628 pc=0x67c19a
sync.(*Once).doSlow(0xc00005c400, 0xc000a99878)
        C:/Go/src/sync/once.go:66 +0xf3 fp=0xc000b67698 sp=0xc000b67648 pc=0x46ec43
sync.(*Once).Do(...)
        C:/Go/src/sync/once.go:57
github.com/sirupsen/logrus.(*TextFormatter).Format(0xc00005c3c0, 0xc0000da1c0, 0xc000a99c50, 0x67bfb4, 0x6db1c0, 0xc000b4c540, 0xc000a99c98)
        C:/Users/Tnze/go/pkg/mod/github.com/sirupsen/[email protected]/text_formatter.go:188 +0xf1d fp=0xc000b67c20 sp=0xc000b67698 pc=0x67a2ed
github.com/sirupsen/logrus.(*Entry).write(0xc0000da1c0)
        C:/Users/Tnze/go/pkg/mod/github.com/sirupsen/[email protected]/entry.go:277 +0x83 fp=0xc000b67ca8 sp=0xc000b67c20 pc=0x6773b3
github.com/sirupsen/logrus.Entry.log(0xc0000da230, 0xc000b4c510, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        C:/Users/Tnze/go/pkg/mod/github.com/sirupsen/[email protected]/entry.go:253 +0x1c9 fp=0xc000b67d20 sp=0xc000b67ca8 pc=0x677029
github.com/sirupsen/logrus.(*Entry).Log(0xc0000da150, 0x4, 0xc000a99e60, 0x1, 0x1)
        C:/Users/Tnze/go/pkg/mod/github.com/sirupsen/[email protected]/entry.go:289 +0xf2 fp=0xc000b67e28 sp=0xc000b67d20 pc=0x677652
github.com/sirupsen/logrus.(*Entry).Logf(0xc0000da150, 0xc000000004, 0x70f1cc, 0x7, 0xc000a99f88, 0x2, 0x2)
        C:/Users/Tnze/go/pkg/mod/github.com/sirupsen/[email protected]/entry.go:335 +0xe9 fp=0xc000b67e80 sp=0xc000b67e28 pc=0x677819
github.com/sirupsen/logrus.(*Logger).Logf(0xc0000da230, 0x4, 0x70f1cc, 0x7, 0xc000a99f88, 0x2, 0x2)
        C:/Users/Tnze/go/pkg/mod/github.com/sirupsen/[email protected]/logger.go:146 +0x9b fp=0xc000b67ed0 sp=0xc000b67e80 pc=0x67883b
github.com/sirupsen/logrus.(*Logger).Infof(...)
        C:/Users/Tnze/go/pkg/mod/github.com/sirupsen/[email protected]/logger.go:160
github.com/sirupsen/logrus.Infof(...)
        C:/Users/Tnze/go/pkg/mod/github.com/sirupsen/[email protected]/exported.go:154
main.(*Player).JoinServer.func2(0xc0000040c0, 0xc000006028, 0xc000086180, 0xc000086240, 0xc0000861e0)
        C:/Users/Tnze/Documents/Projects/Go/MCServerSwitch/proxy.go:205 +0x325 fp=0xc000b67fb8 sp=0xc000b67ed0 pc=0x67f225
runtime.goexit()
        C:/Go/src/runtime/asm_amd64.s:1373 +0x1 fp=0xc000b67fc0 sp=0xc000b67fb8 pc=0x4624f1
created by main.(*Player).JoinServer
        C:/Users/Tnze/Documents/Projects/Go/MCServerSwitch/proxy.go:188 +0xf3

goroutine 1 [IO wait]:
runtime.gopark(0x947c28, 0x27c5df78, 0xc0000c1b02, 0x5)
        C:/Go/src/runtime/proc.go:304 +0xf5 fp=0xc000515a08 sp=0xc0005159e8 pc=0x438595
runtime.netpollblock(0x27c5df50, 0x72, 0xc00095c0f0)
        C:/Go/src/runtime/netpoll.go:419 +0xa1 fp=0xc000515a40 sp=0xc000515a08 pc=0x42f5a1
internal/poll.runtime_pollWait(0x27c5df50, 0x72, 0x996e20)
        C:/Go/src/runtime/netpoll.go:203 +0x5c fp=0xc000515a68 sp=0xc000515a40 pc=0x42ea9c
internal/poll.(*pollDesc).wait(0xc0000cf348, 0x72, 0xb35300, 0x0, 0x0)
        C:/Go/src/internal/poll/fd_poll_runtime.go:87 +0x4c fp=0xc000515a98 sp=0xc000515a68 pc=0x4bc56c
internal/poll.(*ioSrv).ExecIO(0xb76510, 0xc0000cf198, 0xc0000ef320, 0x1, 0x0, 0x1e8)
        C:/Go/src/internal/poll/fd_windows.go:228 +0x121 fp=0xc000515b20 sp=0xc000515a98 pc=0x4bcf01
internal/poll.(*FD).acceptOne(0xc0000cf180, 0x1e8, 0xc00095c0f0, 0x2, 0x2, 0xc0000cf198, 0x400, 0x27c9b000, 0x203000200000000, 0x27caffff)
        C:/Go/src/internal/poll/fd_windows.go:896 +0xa9 fp=0xc000515b70 sp=0xc000515b20 pc=0x4bf5a9
internal/poll.(*FD).Accept(0xc0000cf180, 0xc000515d18, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        C:/Go/src/internal/poll/fd_windows.go:930 +0x15f fp=0xc000515c00 sp=0xc000515b70 pc=0x4bf85f
net.(*netFD).accept(0xc0000cf180, 0x8, 0x6fdaa0, 0x996340)
        C:/Go/src/net/fd_windows.go:193 +0x7b fp=0xc000515d38 sp=0xc000515c00 pc=0x510b3b
net.(*TCPListener).accept(0xc0000ef260, 0x40a43c, 0x6c2a40, 0x20)
        C:/Go/src/net/tcpsock_posix.go:139 +0x39 fp=0xc000515d78 sp=0xc000515d38 pc=0x521519
net.(*TCPListener).Accept(0xc0000ef260, 0x99cbe0, 0xc000006018, 0x996340, 0xc0000c1e78)
        C:/Go/src/net/tcpsock.go:261 +0x6b fp=0xc000515db8 sp=0xc000515d78 pc=0x52043b
github.com/Tnze/go-mc/net.Listener.Accept(0x99a4c0, 0xc0000ef260, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        C:/Users/Tnze/go/pkg/mod/github.com/!tnze/[email protected]/net/conn.go:28 +0x77 fp=0xc000515eb8 sp=0xc000515db8 pc=0x547727
main.main()
        C:/Users/Tnze/Documents/Projects/Go/MCServerSwitch/main.go:17 +0x170 fp=0xc000515f88 sp=0xc000515eb8 pc=0x67ccc0
runtime.main()
        C:/Go/src/runtime/proc.go:203 +0x212 fp=0xc000515fe0 sp=0xc000515f88 pc=0x4381c2
runtime.goexit()
        C:/Go/src/runtime/asm_amd64.s:1373 +0x1 fp=0xc000515fe8 sp=0xc000515fe0 pc=0x4624f1

goroutine 2 [force gc (idle)]:
runtime.gopark(0x947c58, 0xb78000, 0x1411, 0x1)
        C:/Go/src/runtime/proc.go:304 +0xf5 fp=0xc000045fb0 sp=0xc000045f90 pc=0x438595
runtime.goparkunlock(...)
        C:/Go/src/runtime/proc.go:310
runtime.forcegchelper()
        C:/Go/src/runtime/proc.go:253 +0xc5 fp=0xc000045fe0 sp=0xc000045fb0 pc=0x438435
runtime.goexit()
        C:/Go/src/runtime/asm_amd64.s:1373 +0x1 fp=0xc000045fe8 sp=0xc000045fe0 pc=0x4624f1
created by runtime.init.6
        C:/Go/src/runtime/proc.go:242 +0x3c

goroutine 3 [GC sweep wait]:
runtime.gopark(0x947c58, 0xb78140, 0x140c, 0x1)
        C:/Go/src/runtime/proc.go:304 +0xf5 fp=0xc000047fa8 sp=0xc000047f88 pc=0x438595
runtime.goparkunlock(...)
        C:/Go/src/runtime/proc.go:310
runtime.bgsweep(0xc000050000)
        C:/Go/src/runtime/mgcsweep.go:89 +0x13f fp=0xc000047fd8 sp=0xc000047fa8 pc=0x42331f
runtime.goexit()
        C:/Go/src/runtime/asm_amd64.s:1373 +0x1 fp=0xc000047fe0 sp=0xc000047fd8 pc=0x4624f1
created by runtime.gcenable
        C:/Go/src/runtime/mgc.go:214 +0x63

goroutine 4 [sleep]:
runtime.gopark(0x947c58, 0xb78100, 0x1313, 0x2)
        C:/Go/src/runtime/proc.go:304 +0xf5 fp=0xc000057f28 sp=0xc000057f08 pc=0x438595
runtime.goparkunlock(...)
        C:/Go/src/runtime/proc.go:310
runtime.scavengeSleep(0x8000000000000000, 0x125dfc98)
        C:/Go/src/runtime/mgcscavenge.go:214 +0xc6 fp=0xc000057f78 sp=0xc000057f28 pc=0x421726
runtime.bgscavenge(0xc000050000)
        C:/Go/src/runtime/mgcscavenge.go:315 +0x193 fp=0xc000057fd8 sp=0xc000057f78 pc=0x4218e3
runtime.goexit()
        C:/Go/src/runtime/asm_amd64.s:1373 +0x1 fp=0xc000057fe0 sp=0xc000057fd8 pc=0x4624f1
created by runtime.gcenable
        C:/Go/src/runtime/mgc.go:215 +0x85

goroutine 18 [finalizer wait]:
runtime.gopark(0x947c58, 0xba5060, 0x6a1410, 0x1)
        C:/Go/src/runtime/proc.go:304 +0xf5 fp=0xc000049f58 sp=0xc000049f38 pc=0x438595
runtime.goparkunlock(...)
        C:/Go/src/runtime/proc.go:310
runtime.runfinq()
        C:/Go/src/runtime/mfinal.go:175 +0xb1 fp=0xc000049fe0 sp=0xc000049f58 pc=0x418d81
runtime.goexit()
        C:/Go/src/runtime/asm_amd64.s:1373 +0x1 fp=0xc000049fe8 sp=0xc000049fe0 pc=0x4624f1
created by runtime.createfing
        C:/Go/src/runtime/mfinal.go:156 +0x68

goroutine 19 [GC worker (idle)]:
runtime.gopark(0x947ae0, 0xc000016050, 0x1418, 0x0)
        C:/Go/src/runtime/proc.go:304 +0xf5 fp=0xc000053f60 sp=0xc000053f40 pc=0x438595
runtime.gcBgMarkWorker(0xc00001a000)
        C:/Go/src/runtime/mgc.go:1865 +0x114 fp=0xc000053fd8 sp=0xc000053f60 pc=0x41c694
runtime.goexit()
        C:/Go/src/runtime/asm_amd64.s:1373 +0x1 fp=0xc000053fe0 sp=0xc000053fd8 pc=0x4624f1
created by runtime.gcBgMarkStartWorkers
        C:/Go/src/runtime/mgc.go:1813 +0x7e

goroutine 5 [GC worker (idle)]:
runtime.gopark(0x947ae0, 0xc000480000, 0x1418, 0x0)
        C:/Go/src/runtime/proc.go:304 +0xf5 fp=0xc000059f60 sp=0xc000059f40 pc=0x438595
runtime.gcBgMarkWorker(0xc00001c800)
        C:/Go/src/runtime/mgc.go:1865 +0x114 fp=0xc000059fd8 sp=0xc000059f60 pc=0x41c694
runtime.goexit()
        C:/Go/src/runtime/asm_amd64.s:1373 +0x1 fp=0xc000059fe0 sp=0xc000059fd8 pc=0x4624f1
created by runtime.gcBgMarkStartWorkers
        C:/Go/src/runtime/mgc.go:1813 +0x7e

goroutine 34 [GC worker (idle)]:
runtime.gopark(0x947ae0, 0xc000432c30, 0x1418, 0x0)
        C:/Go/src/runtime/proc.go:304 +0xf5 fp=0xc000489f60 sp=0xc000489f40 pc=0x438595
runtime.gcBgMarkWorker(0xc00001f000)
        C:/Go/src/runtime/mgc.go:1865 +0x114 fp=0xc000489fd8 sp=0xc000489f60 pc=0x41c694
runtime.goexit()
        C:/Go/src/runtime/asm_amd64.s:1373 +0x1 fp=0xc000489fe0 sp=0xc000489fd8 pc=0x4624f1
created by runtime.gcBgMarkStartWorkers
        C:/Go/src/runtime/mgc.go:1813 +0x7e

goroutine 6 [GC worker (idle)]:
runtime.gopark(0x947ae0, 0xc000432c40, 0x1418, 0x0)
        C:/Go/src/runtime/proc.go:304 +0xf5 fp=0xc000485f60 sp=0xc000485f40 pc=0x438595
runtime.gcBgMarkWorker(0xc000021800)
        C:/Go/src/runtime/mgc.go:1865 +0x114 fp=0xc000485fd8 sp=0xc000485f60 pc=0x41c694
runtime.goexit()
        C:/Go/src/runtime/asm_amd64.s:1373 +0x1 fp=0xc000485fe0 sp=0xc000485fd8 pc=0x4624f1
created by runtime.gcBgMarkStartWorkers
        C:/Go/src/runtime/mgc.go:1813 +0x7e

goroutine 35 [GC worker (idle)]:
runtime.gopark(0x947ae0, 0xc000480010, 0x1418, 0x0)
        C:/Go/src/runtime/proc.go:304 +0xf5 fp=0xc00048bf60 sp=0xc00048bf40 pc=0x438595
runtime.gcBgMarkWorker(0xc000024000)
        C:/Go/src/runtime/mgc.go:1865 +0x114 fp=0xc00048bfd8 sp=0xc00048bf60 pc=0x41c694
runtime.goexit()
        C:/Go/src/runtime/asm_amd64.s:1373 +0x1 fp=0xc00048bfe0 sp=0xc00048bfd8 pc=0x4624f1
created by runtime.gcBgMarkStartWorkers
        C:/Go/src/runtime/mgc.go:1813 +0x7e

goroutine 36 [GC worker (idle)]:
runtime.gopark(0x947ae0, 0xc000432c50, 0x1418, 0x0)
        C:/Go/src/runtime/proc.go:304 +0xf5 fp=0xc000493f60 sp=0xc000493f40 pc=0x438595
runtime.gcBgMarkWorker(0xc000026800)
        C:/Go/src/runtime/mgc.go:1865 +0x114 fp=0xc000493fd8 sp=0xc000493f60 pc=0x41c694
runtime.goexit()
        C:/Go/src/runtime/asm_amd64.s:1373 +0x1 fp=0xc000493fe0 sp=0xc000493fd8 pc=0x4624f1
created by runtime.gcBgMarkStartWorkers
        C:/Go/src/runtime/mgc.go:1813 +0x7e

goroutine 7 [GC worker (idle)]:
runtime.gopark(0x947ae0, 0xc000016060, 0x1418, 0x0)
        C:/Go/src/runtime/proc.go:304 +0xf5 fp=0xc000487f60 sp=0xc000487f40 pc=0x438595
runtime.gcBgMarkWorker(0xc000029000)
        C:/Go/src/runtime/mgc.go:1865 +0x114 fp=0xc000487fd8 sp=0xc000487f60 pc=0x41c694
runtime.goexit()
        C:/Go/src/runtime/asm_amd64.s:1373 +0x1 fp=0xc000487fe0 sp=0xc000487fd8 pc=0x4624f1
created by runtime.gcBgMarkStartWorkers
        C:/Go/src/runtime/mgc.go:1813 +0x7e

goroutine 8 [GC worker (idle)]:
runtime.gopark(0x947ae0, 0xc000432c60, 0x1418, 0x0)
        C:/Go/src/runtime/proc.go:304 +0xf5 fp=0xc00048ff60 sp=0xc00048ff40 pc=0x438595
runtime.gcBgMarkWorker(0xc00002b800)
        C:/Go/src/runtime/mgc.go:1865 +0x114 fp=0xc00048ffd8 sp=0xc00048ff60 pc=0x41c694
runtime.goexit()
        C:/Go/src/runtime/asm_amd64.s:1373 +0x1 fp=0xc00048ffe0 sp=0xc00048ffd8 pc=0x4624f1
created by runtime.gcBgMarkStartWorkers
        C:/Go/src/runtime/mgc.go:1813 +0x7e

goroutine 37 [GC worker (idle)]:
runtime.gopark(0x947ae0, 0xc000480020, 0x1418, 0x0)
        C:/Go/src/runtime/proc.go:304 +0xf5 fp=0xc000495f60 sp=0xc000495f40 pc=0x438595
runtime.gcBgMarkWorker(0xc00002e000)
        C:/Go/src/runtime/mgc.go:1865 +0x114 fp=0xc000495fd8 sp=0xc000495f60 pc=0x41c694
runtime.goexit()
        C:/Go/src/runtime/asm_amd64.s:1373 +0x1 fp=0xc000495fe0 sp=0xc000495fd8 pc=0x4624f1
created by runtime.gcBgMarkStartWorkers
        C:/Go/src/runtime/mgc.go:1813 +0x7e

goroutine 38 [GC worker (idle)]:
runtime.gopark(0x947ae0, 0xc000432c70, 0x1418, 0x0)
        C:/Go/src/runtime/proc.go:304 +0xf5 fp=0xc00049bf60 sp=0xc00049bf40 pc=0x438595
runtime.gcBgMarkWorker(0xc000030800)
        C:/Go/src/runtime/mgc.go:1865 +0x114 fp=0xc00049bfd8 sp=0xc00049bf60 pc=0x41c694
runtime.goexit()
        C:/Go/src/runtime/asm_amd64.s:1373 +0x1 fp=0xc00049bfe0 sp=0xc00049bfd8 pc=0x4624f1
created by runtime.gcBgMarkStartWorkers
        C:/Go/src/runtime/mgc.go:1813 +0x7e

goroutine 9 [GC worker (idle)]:
runtime.gopark(0x947ae0, 0xc000432c80, 0x1418, 0x0)
        C:/Go/src/runtime/proc.go:304 +0xf5 fp=0xc000491f60 sp=0xc000491f40 pc=0x438595
runtime.gcBgMarkWorker(0xc000033000)
        C:/Go/src/runtime/mgc.go:1865 +0x114 fp=0xc000491fd8 sp=0xc000491f60 pc=0x41c694
runtime.goexit()
        C:/Go/src/runtime/asm_amd64.s:1373 +0x1 fp=0xc000491fe0 sp=0xc000491fd8 pc=0x4624f1
created by runtime.gcBgMarkStartWorkers
        C:/Go/src/runtime/mgc.go:1813 +0x7e

goroutine 20 [GC worker (idle)]:
runtime.gopark(0x947ae0, 0xc000480030, 0x1418, 0x0)
        C:/Go/src/runtime/proc.go:304 +0xf5 fp=0xc000055f60 sp=0xc000055f40 pc=0x438595
runtime.gcBgMarkWorker(0xc000035800)
        C:/Go/src/runtime/mgc.go:1865 +0x114 fp=0xc000055fd8 sp=0xc000055f60 pc=0x41c694
runtime.goexit()
        C:/Go/src/runtime/asm_amd64.s:1373 +0x1 fp=0xc000055fe0 sp=0xc000055fd8 pc=0x4624f1
created by runtime.gcBgMarkStartWorkers
        C:/Go/src/runtime/mgc.go:1813 +0x7e

goroutine 39 [GC worker (idle)]:
runtime.gopark(0x947ae0, 0xc000016070, 0x1418, 0x0)
        C:/Go/src/runtime/proc.go:304 +0xf5 fp=0xc00049df60 sp=0xc00049df40 pc=0x438595
runtime.gcBgMarkWorker(0xc000038000)
        C:/Go/src/runtime/mgc.go:1865 +0x114 fp=0xc00049dfd8 sp=0xc00049df60 pc=0x41c694
runtime.goexit()
        C:/Go/src/runtime/asm_amd64.s:1373 +0x1 fp=0xc00049dfe0 sp=0xc00049dfd8 pc=0x4624f1
created by runtime.gcBgMarkStartWorkers
        C:/Go/src/runtime/mgc.go:1813 +0x7e

goroutine 10 [GC worker (idle)]:
runtime.gopark(0x947ae0, 0xc000016080, 0x1418, 0x0)
        C:/Go/src/runtime/proc.go:304 +0xf5 fp=0xc000497f60 sp=0xc000497f40 pc=0x438595
runtime.gcBgMarkWorker(0xc00003a800)
        C:/Go/src/runtime/mgc.go:1865 +0x114 fp=0xc000497fd8 sp=0xc000497f60 pc=0x41c694
runtime.goexit()
        C:/Go/src/runtime/asm_amd64.s:1373 +0x1 fp=0xc000497fe0 sp=0xc000497fd8 pc=0x4624f1
created by runtime.gcBgMarkStartWorkers
        C:/Go/src/runtime/mgc.go:1813 +0x7e

goroutine 11 [GC worker (idle)]:
runtime.gopark(0x947ae0, 0xc000432c90, 0x1418, 0x0)
        C:/Go/src/runtime/proc.go:304 +0xf5 fp=0xc000499f60 sp=0xc000499f40 pc=0x438595
runtime.gcBgMarkWorker(0xc00003d000)
        C:/Go/src/runtime/mgc.go:1865 +0x114 fp=0xc000499fd8 sp=0xc000499f60 pc=0x41c694
runtime.goexit()
        C:/Go/src/runtime/asm_amd64.s:1373 +0x1 fp=0xc000499fe0 sp=0xc000499fd8 pc=0x4624f1
created by runtime.gcBgMarkStartWorkers
        C:/Go/src/runtime/mgc.go:1813 +0x7e

goroutine 40 [GC worker (idle)]:
runtime.gopark(0x947ae0, 0xc000016090, 0x1418, 0x0)
        C:/Go/src/runtime/proc.go:304 +0xf5 fp=0xc0004a3f60 sp=0xc0004a3f40 pc=0x438595
runtime.gcBgMarkWorker(0xc00003f800)
        C:/Go/src/runtime/mgc.go:1865 +0x114 fp=0xc0004a3fd8 sp=0xc0004a3f60 pc=0x41c694
runtime.goexit()
        C:/Go/src/runtime/asm_amd64.s:1373 +0x1 fp=0xc0004a3fe0 sp=0xc0004a3fd8 pc=0x4624f1
created by runtime.gcBgMarkStartWorkers
        C:/Go/src/runtime/mgc.go:1813 +0x7e

goroutine 12 [chan receive]:
runtime.gopark(0x947a58, 0xc000086238, 0xc0000b170e, 0x2)
        C:/Go/src/runtime/proc.go:304 +0xf5 fp=0xc000511710 sp=0xc0005116f0 pc=0x438595
runtime.chanrecv(0xc0000861e0, 0x0, 0xc000086201, 0xc0000861e0)
        C:/Go/src/runtime/chan.go:525 +0x2f5 fp=0xc0005117a0 sp=0xc000511710 pc=0x4061a5
runtime.chanrecv1(0xc0000861e0, 0x0)
        C:/Go/src/runtime/chan.go:407 +0x2b fp=0xc0005117d0 sp=0xc0005117a0 pc=0x405e5b
main.handleConn(0xc0008bb6c0)
        C:/Users/Tnze/Documents/Projects/Go/MCServerSwitch/proxy.go:41 +0x5fb fp=0xc000511fd8 sp=0xc0005117d0 pc=0x67d42b
runtime.goexit()
        C:/Go/src/runtime/asm_amd64.s:1373 +0x1 fp=0xc000511fe0 sp=0xc000511fd8 pc=0x4624f1
created by main.main
        C:/Users/Tnze/Documents/Projects/Go/MCServerSwitch/main.go:21 +0x115

goroutine 14 [IO wait]:
runtime.gopark(0x947c28, 0x27c5ddb8, 0xc0000c1b02, 0x5)
        C:/Go/src/runtime/proc.go:304 +0xf5 fp=0xc0004adbc8 sp=0xc0004adba8 pc=0x438595
runtime.netpollblock(0x27c5dd90, 0x72, 0xc000000001)
        C:/Go/src/runtime/netpoll.go:419 +0xa1 fp=0xc0004adc00 sp=0xc0004adbc8 pc=0x42f5a1
internal/poll.runtime_pollWait(0x27c5dd90, 0x72, 0x996e20)
        C:/Go/src/runtime/netpoll.go:203 +0x5c fp=0xc0004adc28 sp=0xc0004adc00 pc=0x42ea9c
internal/poll.(*pollDesc).wait(0xc0000cf848, 0x72, 0xb35300, 0x0, 0x0)
        C:/Go/src/internal/poll/fd_poll_runtime.go:87 +0x4c fp=0xc0004adc58 sp=0xc0004adc28 pc=0x4bc56c
internal/poll.(*ioSrv).ExecIO(0xb76510, 0xc0000cf698, 0x947620, 0xc0000cf4f0, 0x0, 0x0)
        C:/Go/src/internal/poll/fd_windows.go:228 +0x121 fp=0xc0004adce0 sp=0xc0004adc58 pc=0x4bcf01
internal/poll.(*FD).Read(0xc0000cf680, 0xc00095f000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
        C:/Go/src/internal/poll/fd_windows.go:527 +0x2fc fp=0xc0004add60 sp=0xc0004adce0 pc=0x4be38c
net.(*netFD).Read(0xc0000cf680, 0xc00095f000, 0x1000, 0x1000, 0x6d9ca0, 0x100c000b5c250, 0x0)
        C:/Go/src/net/fd_windows.go:152 +0x56 fp=0xc0004addc0 sp=0xc0004add60 pc=0x510896
net.(*conn).Read(0xc000006020, 0xc00095f000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
        C:/Go/src/net/net.go:184 +0x95 fp=0xc0004ade20 sp=0xc0004addc0 pc=0x51b765
bufio.(*Reader).fill(0xc00005c6c0)
        C:/Go/src/bufio/bufio.go:100 +0x10a fp=0xc0004ade70 sp=0xc0004ade20 pc=0x4f0dfa
bufio.(*Reader).ReadByte(0xc00005c6c0, 0xc0004adef8, 0x51b9c5, 0xc0000cf400)
        C:/Go/src/bufio/bufio.go:252 +0x40 fp=0xc0004ade90 sp=0xc0004ade70 pc=0x4f16a0
github.com/Tnze/go-mc/net/packet.RecvPacket(0x995f20, 0xc00005c6c0, 0xc000086101, 0x0, 0x0, 0x0)
        C:/Users/Tnze/go/pkg/mod/github.com/!tnze/[email protected]/net/packet/packet.go:70 +0x63 fp=0xc0004adf10 sp=0xc0004ade90 pc=0x542da3
github.com/Tnze/go-mc/net.(*Conn).ReadPacket(0xc0008bb940, 0xc000086180, 0xc000b5c200, 0x3, 0x3, 0x0, 0x0)
        C:/Users/Tnze/go/pkg/mod/github.com/!tnze/[email protected]/net/conn.go:80 +0x4d fp=0xc0004adf50 sp=0xc0004adf10 pc=0x547dad
main.(*Player).JoinServer.func1(0xc000006028, 0xc0000040c0, 0xc000086180, 0xc000086240)
        C:/Users/Tnze/Documents/Projects/Go/MCServerSwitch/proxy.go:174 +0x5e fp=0xc0004adfc0 sp=0xc0004adf50 pc=0x67ed6e
runtime.goexit()
        C:/Go/src/runtime/asm_amd64.s:1373 +0x1 fp=0xc0004adfc8 sp=0xc0004adfc0 pc=0x4624f1
created by main.(*Player).JoinServer
        C:/Users/Tnze/Documents/Projects/Go/MCServerSwitch/proxy.go:170 +0xa9

Process finished with exit code 2
@Tnze
Copy link
Author

Tnze commented Apr 9, 2020

I am using Goland. It happens when I click the "Run" button or just go run in terminal. But if I using Debug button to run, nothing wrong happens again.

@fkollmann
Copy link
Contributor

This issue is handled over at logrus issue sirupsen/logrus#1112 . Thanks for the feedback. I did not realize that this issue was that common until now, sry for that.

fkollmann added a commit that referenced this issue Apr 28, 2020
@fkollmann
Copy link
Contributor

Fix is available in v1.0.3

@mdempsky
Copy link

Hi, I work on the Go compiler. In Go 1.14, I added a new compiler option (disabled by default) for detecting misuse of unsafe.Pointer, which I think could have caught this or at least identified the origin of the mistake easier. However, I don't have a Windows computer to easily confirm that hypothesis.

Would someone mind testing the unfixed code (i.e., before 71a52a1) with -gcflags=all=-d=checkptr to see if any checkptr error messages are printed? This command line flag will work with any of go build, go run, or go test.

Thanks.

@fkollmann
Copy link
Contributor

@mdempsky I did the requested test but did not see a difference:

image

The resulting binary is still crashing. go1.14.2 windows/amd64

Can you point me to the documentation why this is a "misuse of unsafe.Pointer"? I have other projects too and never thought of unsafe.Pointer as some kind of special type...

@mdempsky
Copy link

mdempsky commented May 1, 2020

@fkollmann Thanks. Can you run the resulting program and copy/paste the error message here? checkptr is an additional runtime instrumentation feature, like the race detector or memory sanitizer. It doesn't report errors at build time. Sorry for not being clearer about that.

The runtime expects any value stored in unsafe.Pointer to be a valid pointer. If you convert an arbitrary integer value (e.g., a Windows handle), it can cause the GC to misbehave. That's why the package is named "unsafe". :)

For more details on allowed uses of unsafe.Pointer, please see: https://golang.org/pkg/unsafe/#Pointer

@fkollmann
Copy link
Contributor

@mdempsky looks like it works?

fatal error: checkptr: unsafe pointer arithmetic

Full stack: https://gist.github.com/fkollmann/5a578985e8746323f13e5f2e1bb19892

@mdempsky
Copy link

mdempsky commented May 1, 2020

Indeed it does. Thanks for the confirmation!

For what it's worth, it looks like "go vet github.com/konsorten/go-windows-terminal-sequences" was warning about this issue too.

@fkollmann
Copy link
Contributor

@mdempsky Thanks! I guess this is on me then 😇 . I will add go vet to the release process of our libraries.

kirileec added a commit to linxlib/logs that referenced this issue Aug 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants