mirror of
https://github.com/pgsty/minio.git
synced 2026-08-02 16:45:57 +03: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:
+3
-4
@@ -17,6 +17,7 @@
|
||||
package rpc
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"encoding/gob"
|
||||
@@ -49,8 +50,7 @@ func (client *Client) Call(serviceMethod string, args, reply interface{}) error
|
||||
return fmt.Errorf("rpc reply must be a pointer type, but found %v", replyKind)
|
||||
}
|
||||
|
||||
argBuf := bufPool.Get()
|
||||
defer bufPool.Put(argBuf)
|
||||
argBuf := bytes.NewBuffer(make([]byte, 0, 1024))
|
||||
|
||||
if err := gobEncodeBuf(args, argBuf); err != nil {
|
||||
return err
|
||||
@@ -61,8 +61,7 @@ func (client *Client) Call(serviceMethod string, args, reply interface{}) error
|
||||
ArgBytes: argBuf.Bytes(),
|
||||
}
|
||||
|
||||
reqBuf := bufPool.Get()
|
||||
defer bufPool.Put(reqBuf)
|
||||
reqBuf := bytes.NewBuffer(make([]byte, 0, 1024))
|
||||
if err := gob.NewEncoder(reqBuf).Encode(callRequest); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user