mirror of
https://github.com/minio/minio.git
synced 2025-11-20 18:06:10 -05:00
rpc: Avoid using Pool since it conflicts with http2 (#7467)
A race is detected between a bytes.Buffer generated with cmd/rpc.Pool and http2 module. An issue is raised in golang (https://github.com/golang/go/issues/31192). Meanwhile, this commit disables Pool in RPC code and it generates a new 1kb of bytes.Buffer for each RPC call.
This commit is contained in:
@@ -40,8 +40,6 @@ var errorType = reflect.TypeOf((*error)(nil)).Elem()
|
||||
// reflect.Type of Authenticator interface.
|
||||
var authenticatorType = reflect.TypeOf((*Authenticator)(nil)).Elem()
|
||||
|
||||
var bufPool = NewPool()
|
||||
|
||||
func gobEncodeBuf(e interface{}, buf *bytes.Buffer) error {
|
||||
return gob.NewEncoder(buf).Encode(e)
|
||||
}
|
||||
@@ -239,8 +237,8 @@ func (server *Server) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
||||
}
|
||||
|
||||
callResponse := CallResponse{}
|
||||
buf := bufPool.Get()
|
||||
defer bufPool.Put(buf)
|
||||
|
||||
buf := bytes.NewBuffer(make([]byte, 0, 1024))
|
||||
|
||||
if err := server.call(callRequest.Method, callRequest.ArgBytes, buf); err != nil {
|
||||
callResponse.Error = err.Error()
|
||||
|
||||
Reference in New Issue
Block a user