limit log vertex size with 1M to avoid huge grpc message making client buffer overflow
Signed-off-by: sunchunming <sunchunming1@jd.com>master
parent
a87b801ca0
commit
bb24010f6e
|
@ -333,8 +333,8 @@ func (c *Controller) Status(req *controlapi.StatusRequest, stream controlapi.Con
|
|||
return nil
|
||||
}
|
||||
logSize := 0
|
||||
retry := false
|
||||
for {
|
||||
retry := false
|
||||
sr := controlapi.StatusResponse{}
|
||||
for _, v := range ss.Vertexes {
|
||||
sr.Vertexes = append(sr.Vertexes, &controlapi.Vertex{
|
||||
|
@ -366,7 +366,7 @@ func (c *Controller) Status(req *controlapi.StatusRequest, stream controlapi.Con
|
|||
Msg: v.Data,
|
||||
Timestamp: v.Timestamp,
|
||||
})
|
||||
logSize += len(v.Data)
|
||||
logSize += len(v.Data) + emptyLogVertexSize
|
||||
// avoid logs growing big and split apart if they do
|
||||
if logSize > 1024*1024 {
|
||||
ss.Vertexes = nil
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
package control
|
||||
|
||||
import controlapi "github.com/moby/buildkit/api/services/control"
|
||||
|
||||
var emptyLogVertexSize int
|
||||
|
||||
func init() {
|
||||
emptyLogVertex := controlapi.VertexLog{}
|
||||
emptyLogVertexSize = emptyLogVertex.Size()
|
||||
}
|
Loading…
Reference in New Issue