Reduce error logs in transport. (#2117)
This commit is contained in:
@ -365,7 +365,17 @@ func newLoopyWriter(s side, fr *framer, cbuf *controlBuffer, bdpEst *bdpEstimato
|
|||||||
const minBatchSize = 1000
|
const minBatchSize = 1000
|
||||||
|
|
||||||
// run should be run in a separate goroutine.
|
// run should be run in a separate goroutine.
|
||||||
func (l *loopyWriter) run() error {
|
func (l *loopyWriter) run() (err error) {
|
||||||
|
defer func() {
|
||||||
|
if err == ErrConnClosing {
|
||||||
|
// Don't log ErrConnClosing as error since it happens
|
||||||
|
// 1. When the connection is closed by some other known issue.
|
||||||
|
// 2. User closed the connection.
|
||||||
|
// 3. A graceful close of connection.
|
||||||
|
infof("transport: loopyWriter.run returning. %v", err)
|
||||||
|
err = nil
|
||||||
|
}
|
||||||
|
}()
|
||||||
for {
|
for {
|
||||||
it, err := l.cbuf.get(true)
|
it, err := l.cbuf.get(true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -296,10 +296,11 @@ func newHTTP2Client(connectCtx, ctx context.Context, addr TargetInfo, opts Conne
|
|||||||
go func() {
|
go func() {
|
||||||
t.loopy = newLoopyWriter(clientSide, t.framer, t.controlBuf, t.bdpEst)
|
t.loopy = newLoopyWriter(clientSide, t.framer, t.controlBuf, t.bdpEst)
|
||||||
err := t.loopy.run()
|
err := t.loopy.run()
|
||||||
errorf("transport: loopyWriter.run returning. Err: %v", err)
|
if err != nil {
|
||||||
|
errorf("transport: loopyWriter.run returning. Err: %v", err)
|
||||||
|
}
|
||||||
// If it's a connection error, let reader goroutine handle it
|
// If it's a connection error, let reader goroutine handle it
|
||||||
// since there might be data in the buffers.
|
// since there might be data in the buffers.
|
||||||
|
|
||||||
if _, ok := err.(net.Error); !ok {
|
if _, ok := err.(net.Error); !ok {
|
||||||
t.conn.Close()
|
t.conn.Close()
|
||||||
}
|
}
|
||||||
|
@ -273,8 +273,9 @@ func newHTTP2Server(conn net.Conn, config *ServerConfig) (_ ServerTransport, err
|
|||||||
go func() {
|
go func() {
|
||||||
t.loopy = newLoopyWriter(serverSide, t.framer, t.controlBuf, t.bdpEst)
|
t.loopy = newLoopyWriter(serverSide, t.framer, t.controlBuf, t.bdpEst)
|
||||||
t.loopy.ssGoAwayHandler = t.outgoingGoAwayHandler
|
t.loopy.ssGoAwayHandler = t.outgoingGoAwayHandler
|
||||||
err := t.loopy.run()
|
if err := t.loopy.run(); err != nil {
|
||||||
errorf("transport: loopyWriter.run returning. Err: %v", err)
|
errorf("transport: loopyWriter.run returning. Err: %v", err)
|
||||||
|
}
|
||||||
t.conn.Close()
|
t.conn.Close()
|
||||||
close(t.writerDone)
|
close(t.writerDone)
|
||||||
}()
|
}()
|
||||||
|
Reference in New Issue
Block a user