chengning created THRIFT-4105: --------------------------------- Summary: used too much memory randomly Key: THRIFT-4105 URL: https://issues.apache.org/jira/browse/THRIFT-4105 Project: Thrift Issue Type: Bug Components: Go - Library Reporter: chengning Priority: Critical
In my golang project used thrift, high memory usage once or twice a week. Use go tool pprof can find the following information. We did not use thrift to pass larger strings, but they allocate a string with the size of 352.20MB I think there may be a problem (pprof) top 704.39MB of 709.32MB total (99.31%) Dropped 215 nodes (cum <= 3.55MB) flat flat% sum% cum cum% 704.39MB 99.31% 99.31% 704.39MB 99.31% git.apache.org/thrift.git/lib/go/thrift.(*TBinaryProtocol).readStringBody 0 0% 99.31% 704.39MB 99.31% git.apache.org/thrift.git/lib/go/thrift.(*TBinaryProtocol).ReadMessageBegin 0 0% 99.31% 705.03MB 99.39% git.apache.org/thrift.git/lib/go/thrift.(*TSimpleServer).AcceptLoop.func1 0 0% 99.31% 705.03MB 99.39% git.apache.org/thrift.git/lib/go/thrift.(*TSimpleServer).processRequests 0 0% 99.31% 705.03MB 99.39% letv.com/rpc_server/thrift.(*VideoCallThriftProcessor).Process 0 0% 99.31% 708.82MB 99.93% runtime.goexit (pprof) list readStringBody Total: 709.32MB ROUTINE ======================== git.apache.org/thrift.git/lib/go/thrift.(*TBinaryProtocol).readStringBody in /letv/cloudim/letv-videocall-server/src/git.apache.org/thrift.git/lib/go/thrift/binary_protocol.go 704.39MB 704.39MB (flat, cum) 99.31% of Total . . 482: } . . 483: var buf []byte . . 484: if int(size) <= len(p.buffer) { . . 485: buf = p.buffer[0:size] . . 486: } else { 352.20MB 352.20MB 487: buf = make([]byte, size) . . 488: } . . 489: _, e := io.ReadFull(p.trans, buf) 352.20MB 352.20MB 490: return string(buf), NewTProtocolException(e) . . 491:} (pprof) list ReadMessageBegin Total: 709.32MB ROUTINE ======================== git.apache.org/thrift.git/lib/go/thrift.(*TBinaryProtocol).ReadMessageBegin in /letv/cloudim/letv-videocall-server/src/git.apache.org/thrift.git/lib/go/thrift/binary_protocol.go 0 704.39MB (flat, cum) 99.31% of Total . . 256: return name, typeId, seqId, nil . . 257: } . . 258: if p.strictRead { . . 259: return name, typeId, seqId, NewTProtocolExceptionWithType(BAD_VERSION, fmt.Errorf("Missing version in ReadMessageBegin")) . . 260: } . 704.39MB 261: name, e2 := p.readStringBody(size) . . 262: if e2 != nil { . . 263: return name, typeId, seqId, e2 . . 264: } . . 265: b, e3 := p.ReadByte() . . 266: if e3 != nil { -- This message was sent by Atlassian JIRA (v6.3.15#6346)