websocket icon indicating copy to clipboard operation
websocket copied to clipboard

[BUG] runtime: out of memory: cannot allocate 187650799566848-byte block (1389953024 in use) fatal error: out of memory

Open chenwei113524 opened this issue 3 months ago • 3 comments

Is there an existing issue for this?

  • [x] I have searched the existing issues

Current Behavior

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

goroutine 31338763 gp=0x402ef0b6c0 m=29 mp=0x40034e5008 [running]: runtime.throw({0xaaaadb1ad670?, 0x55556d8e6?}) /opt/buildtools/golang_go-1.22.1/src/runtime/panic.go:1023 +0x40 fp=0x4004059850 sp=0x4004059820 pc=0xaaaada2de220 runtime.(*mcache).allocLarge(0x40040598c8?, 0xaaaadb1cc000, 0x1) /opt/buildtools/golang_go-1.22.1/src/runtime/mcache.go:236 +0x1e0 fp=0x40040598a0 sp=0x4004059850 pc=0xaaaada2ba1e0 runtime.mallocgc(0xaaaadb1cc000, 0x0, 0x0) /opt/buildtools/golang_go-1.22.1/src/runtime/malloc.go:1165 +0x534 fp=0x4004059930 sp=0x40040598a0 pc=0xaaaada2b1024 runtime.growslice(0x400b81e5d0, 0x545845544e?, 0x4004059a08?, 0xaaaada3ac4ec?, 0xaaaadb5d2d40?) /opt/buildtools/golang_go-1.22.1/src/runtime/slice.go:242 +0x444 fp=0x4004059990 sp=0x4004059930 pc=0xaaaada2f9d94 github.com/gorilla/websocket.(*CloseError).Error(0xaaaadc3b2970) /devcloud/data/gopath/pkg/mod/github.com/gorilla/[email protected]/conn.go:144 +0x56c fp=0x4004059a10 sp=0x4004059990 pc=0xaaaada8ef53c fmt.(*pp).handleMethods(0x40092521a0, 0xda2b0bd8?) /opt/buildtools/golang_go-1.22.1/src/fmt/print.go:667 +0x338 fp=0x4004059be0 sp=0x4004059a10 pc=0xaaaada3ac618 fmt.(*pp).printArg(0x40092521a0, {0xaaaadb597c00, 0xaaaadc3b2970}, 0x73) /opt/buildtools/golang_go-1.22.1/src/fmt/print.go:756 +0x3e0 fp=0x4004059c80 sp=0x4004059be0 pc=0xaaaada3ace10 fmt.(*pp).doPrintf(0x40092521a0, {0xaaaadb1e9206, 0x2f}, {0x4004059f20, 0x1, 0x1}) /opt/buildtools/golang_go-1.22.1/src/fmt/print.go:1075 +0x2d8 fp=0x4004059d80 sp=0x4004059c80 pc=0xaaaada3af658 fmt.Sprintf({0xaaaadb1e9206, 0x2f}, {0x4004059f20, 0x1, 0x1}) /opt/buildtools/golang_go-1.22.1/src/fmt/print.go:239 +0x4c fp=0x4004059de0 sp=0x4004059d80 pc=0xaaaada3a9b6c xxxx/sparklesearch/runtime/common/logger.writeRunLog({0xaaaadb19a99e, 0x4}, {0xaaaadb80ff20?, 0x400c2fb460?}, {0xaaaadb1e9206, 0x2f}, {0x4004059f20, 0x1, 0x1}) /devcloud/ws/sqaLD/workspace/j_BCQWKIDS/AgentRuntimeService/src/common/logger/run_log.go:79 +0xa8 fp=0x4004059e70 sp=0x4004059de0 pc=0xaaaadae88778 xxxx/sparklesearch/runtime/common/logger.Info(...) /devcloud/ws/sqaLD/workspace/j_BCQWKIDS/AgentRuntimeService/src/common/logger/run_log.go:110 xxxx/sparklesearch/runtime/internal/controller.readMessage(0x4005631200, {0xaaaadb8338a0, 0x400c2fb460}, 0x40007e61e0, 0x400b7b5e00) /devcloud/ws/sqaLD/workspace/j_BCQWKIDS/AgentRuntimeService/src/internal/controller/agent_run_handler.go:238 +0x2cc fp=0x4004059f70 sp=0x4004059e70 pc=0xaaaadb16a37c xxxx/sparklesearch/runtime/internal/controller.(*AgentRunHandlerV1).ProcessHandler.func1.2() /devcloud/ws/sqaLD/workspace/j_BCQWKIDS/AgentRuntimeService/src/internal/controller/agent_run_handler.go:209 +0x70 fp=0x4004059fd0 sp=0x4004059f70 pc=0xaaaadb169e70 runtime.goexit({}) /opt/buildtools/golang_go-1.22.1/src/runtime/asm_arm64.s:1222 +0x4 fp=0x4004059fd0 sp=0x4004059fd0 pc=0xaaaada31aa54 created by xxxx/sparklesearch/runtime/internal/controller.(*AgentRunHandlerV1).ProcessHandler.func1 in goroutine 31338775 /devcloud/ws/sqaLD/workspace/j_BCQWKIDS/AgentRuntimeService/src/internal/controller/agent_run_handler.go:203 +0x440

Expected Behavior

No response

Steps To Reproduce

No response

Anything else?

No response

chenwei113524 avatar Sep 19 '25 07:09 chenwei113524

The program panics when appending a very large CloseError.Text to the print buffer.

The connection limits CloseError.Text to 125 bytes.

Did your application create the CloseError separate from the connection?

ghost avatar Sep 20 '25 21:09 ghost

my application donot create the CloseError. I use like this _, msg, err := conn.ReadMessage() if err != nil { logger.Info(ctx, "routine: websocket read empty message, err = %s", err) return } @tollwayclout

chenwei113524 avatar Sep 23 '25 02:09 chenwei113524

I cannot find a code path where the connection creates CloseError.Text with size > 125.

Try running your application with the race detector. Perhaps a data race is breaking expectations.

ghost avatar Sep 23 '25 20:09 ghost