ginuerzh / gost

GO Simple Tunnel - a simple tunnel written in golang
MIT License
15.49k stars 2.43k forks source link

runtime: out of memory #822

Open hailiangchen opened 2 years ago

hailiangchen commented 2 years ago

After a while, the program will run out of memory and exit automatically Run using the following method

gost -L ss://xxxxxx -F http2://xxxxxx


runtime: out of memory: cannot allocate 4194304-byte block (2892103680 in use)
fatal error: out of memory

goroutine 590748 [running]:
runtime.throw(0x79cd63, 0xd)
    /usr/local/go/src/runtime/panic.go:1116 +0x5c fp=0x14b5db8 sp=0x14b5da4 pc=0x451b0
runtime.(*mcache).refill(0xb6f20088, 0x85)
    /usr/local/go/src/runtime/mcache.go:140 +0xfc fp=0x14b5dcc sp=0x14b5db8 pc=0x25d40
runtime.(*mcache).nextFree(0xb6f20088, 0x9bc1b785, 0x7d7610, 0x9bc1b7d0, 0x7d7628)
    /usr/local/go/src/runtime/malloc.go:868 +0x7c fp=0x14b5dec sp=0x14b5dcc pc=0x1b108
runtime.mallocgc(0x8000, 0x6cc190, 0x1, 0x1)
    /usr/local/go/src/runtime/malloc.go:1036 +0x76c fp=0x14b5e50 sp=0x14b5dec pc=0x1ba1c
runtime.makeslice(0x6cc190, 0x8000, 0x8000, 0x0)
    /usr/local/go/src/runtime/slice.go:49 +0x6c fp=0x14b5e64 sp=0x14b5e50 pc=0x5e2dc
github.com/shadowsocks/shadowsocks-go/shadowsocks.(*Conn).write(0x9f9301e0, 0x9e00e000, 0x8000, 0x8000, 0x9cdc9c00, 0x9cdc9cc4, 0x97804c74)
    /home/gerry/go/pkg/mod/github.com/shadowsocks/shadowsocks-go@v0.0.0-20170121203516-97a5c71f80ba/shadowsocks/conn.go:172 +0x168 fp=0x14b5e98 sp=0x14b5e
64 pc=0x53e32c
github.com/shadowsocks/shadowsocks-go/shadowsocks.(*Conn).Write(0x9f9301e0, 0x9e00e000, 0x8000, 0x8000, 0x8000, 0x0, 0x0)
    /home/gerry/go/pkg/mod/github.com/shadowsocks/shadowsocks-go@v0.0.0-20170121203516-97a5c71f80ba/shadowsocks/conn.go:152 +0x4c fp=0x14b5ec8 sp=0x14b5e9
8 pc=0x53e11c
github.com/ginuerzh/gost.(*shadowConn).Write(0xa3daf4a0, 0x9e00e000, 0x8000, 0x8000, 0x8000, 0x0, 0x0)
    /home/gerry/code/ginuerzh/gost/ss.go:506 +0xfc fp=0x14b5ee8 sp=0x14b5ec8 pc=0x5dc400
io.copyBuffer(0xa6b67ca0, 0xa3daf4a0, 0xa6b67cb8, 0x9f930300, 0x9e00e000, 0x8000, 0x8000, 0x10, 0x6cfeb0, 0x1, ...)
    /usr/local/go/src/io/io.go:407 +0x1b0 fp=0x14b5f28 sp=0x14b5ee8 pc=0x831e4
io.CopyBuffer(0xa6b67ca0, 0xa3daf4a0, 0xa6b67cb8, 0x9f930300, 0x9e00e000, 0x8000, 0x8000, 0x6e62e8, 0x74f820, 0xa6b67cb8, ...)
    /usr/local/go/src/io/io.go:378 +0x5c fp=0x14b5f58 sp=0x14b5f28 pc=0x82fd8
github.com/ginuerzh/gost.copyBuffer(0xa6b67ca0, 0xa3daf4a0, 0xa6b67cb8, 0x9f930300, 0x0, 0x0)
    /home/gerry/code/ginuerzh/gost/server.go:126 +0xe0 fp=0x14b5fa8 sp=0x14b5f58 pc=0x5c54f0
github.com/ginuerzh/gost.transport.func1(0x9ef93f00, 0xa6c6e1f8, 0xa3daf4a0, 0xa6c6e210, 0x9f930300)
    /home/gerry/code/ginuerzh/gost/server.go:108 +0x7c fp=0x14b5fd4 sp=0x14b5fa8 pc=0x5f33dc
runtime.goexit()
    /usr/local/go/src/runtime/asm_arm.s:857 +0x4 fp=0x14b5fd4 sp=0x14b5fd4 pc=0x77788
created by github.com/ginuerzh/gost.transport
    /home/gerry/code/ginuerzh/gost/server.go:107 +0x60

goroutine 1 [select (no cases), 23877 minutes]:
main.main()
    /home/gerry/code/ginuerzh/gost/cmd/gost/main.go:92 +0x300

goroutine 18 [select, 23877 minutes]:
gopkg.in/xtaci/kcp-go%2ev4.(*updateHeap).updateTask(0xdd04e0)
    /home/gerry/go/pkg/mod/gopkg.in/xtaci/kcp-go.v4@v4.3.2/updater.go:81 +0x1cc
created by gopkg.in/xtaci/kcp-go%2ev4.init.2
    /home/gerry/go/pkg/mod/gopkg.in/xtaci/kcp-go.v4@v4.3.2/updater.go:13 +0x5c

goroutine 21 [sleep, 3 minutes]:
time.Sleep(0xd964b800, 0x45)
    /usr/local/go/src/runtime/time.go:188 +0xec
github.com/shadowsocks/shadowsocks-go/shadowsocks.newReqList.func1(0x15132f0)
    /home/gerry/go/pkg/mod/github.com/shadowsocks/shadowsocks-go@v0.0.0-20170121203516-97a5c71f80ba/shadowsocks/udprelay.go:80 +0x2c
created by github.com/shadowsocks/shadowsocks-go/shadowsocks.newReqList
    /home/gerry/go/pkg/mod/github.com/shadowsocks/shadowsocks-go@v0.0.0-20170121203516-97a5c71f80ba/shadowsocks/udprelay.go:78 +0x5c

goroutine 14921 [select, 22716 minutes]:
io.(*pipe).Read(0x167ea00, 0x9b50000, 0x7ffff, 0x80000, 0x435a1c, 0x9b50000, 0x4de76f0)
    /usr/local/go/src/io/pipe.go:57 +0xac
io.(*PipeReader).Read(0x1a3f698, 0x9b50000, 0x7ffff, 0x80000, 0xcfaae54c, 0x3f72, 0xdd0740)
    /usr/local/go/src/io/pipe.go:134 +0x38
golang.org/x/net/http2.(*clientStream).writeRequestBody(0x6bb00b0, 0x8bc558, 0x1a3f698, 0xa6ae2078, 0x1a3f698, 0x0, 0x0)
    /home/gerry/go/pkg/mod/golang.org/x/net@v0.0.0-20190923162816-aa69164e4478/http2/transport.go:1248 +0x490
golang.org/x/net/http2.(*Transport).getBodyWriterState.func1()
    /home/gerry/go/pkg/mod/golang.org/x/net@v0.0.0-20190923162816-aa69164e4478/http2/transport.go:2486 +0xa4
created by golang.org/x/net/http2.bodyWriterState.scheduleBodyWrite
    /home/gerry/go/pkg/mod/golang.org/x/net@v0.0.0-20190923162816-aa69164e4478/http2/transport.go:2533 +0xa4

goroutine 6 [IO wait]:
internal/poll.runtime_pollWait(0xa6b67b90, 0x72, 0x0)
    /usr/local/go/src/runtime/netpoll.go:203 +0x44
internal/poll.(*pollDesc).wait(0x1c64154, 0x72, 0x0, 0x0, 0x78de16)
    /usr/local/go/src/internal/poll/fd_poll_runtime.go:87 +0x30
internal/poll.(*pollDesc).waitRead(...)
    /usr/local/go/src/internal/poll/fd_poll_runtime.go:92
internal/poll.(*FD).Accept(0x1c64140, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
    /usr/local/go/src/internal/poll/fd_unix.go:384 +0x1b0
net.(*netFD).accept(0x1c64140, 0xb4, 0x1, 0x0)
    /usr/local/go/src/net/fd_unix.go:238 +0x20
net.(*TCPListener).accept(0x140cee0, 0x29, 0x0, 0x0)
    /usr/local/go/src/net/tcpsock_posix.go:139 +0x20
net.(*TCPListener).AcceptTCP(0x140cee0, 0xe8d60800, 0x29, 0x4fc38)
    /usr/local/go/src/net/tcpsock.go:248 +0x4c
github.com/ginuerzh/gost.tcpKeepAliveListener.Accept(0x140cee0, 0x14aeeb4, 0xc, 0x1482460, 0x5c514c)
    /home/gerry/code/ginuerzh/gost/tcp.go:59 +0x1c
github.com/ginuerzh/gost.(*Server).Serve(0x1c66940, 0x8bf768, 0x140cef0, 0x0, 0x0, 0x0, 0x2, 0x788ec6)
    /home/gerry/code/ginuerzh/gost/server.go:65 +0xa4
main.(*router).Serve(0x1470240, 0x1, 0x14701b0)
    /home/gerry/code/ginuerzh/gost/cmd/gost/route.go:651 +0x160
created by main.start
    /home/gerry/code/ginuerzh/gost/cmd/gost/main.go:117 +0xf4