You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@skywalking.apache.org by li...@apache.org on 2025/06/06 13:58:19 UTC
(skywalking-rover) 01/01: Fully reading buffer and downgrade log level
This is an automated email from the ASF dual-hosted git repository.
liuhan pushed a commit to branch fully-reading-buddy
in repository https://gitbox.apache.org/repos/asf/skywalking-rover.git
commit 2afe6735f64eb41b3a39a4724ea1b84cb7cc1401
Author: mrproliu <74...@qq.com>
AuthorDate: Fri Jun 6 17:50:35 2025 +0800
Fully reading buffer and downgrade log level
---
pkg/accesslog/collector/protocols/http1.go | 2 +-
.../network/analyze/layer7/protocols/http1/reader/reader.go | 10 ++++++----
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/pkg/accesslog/collector/protocols/http1.go b/pkg/accesslog/collector/protocols/http1.go
index b975d23..8a76a2c 100644
--- a/pkg/accesslog/collector/protocols/http1.go
+++ b/pkg/accesslog/collector/protocols/http1.go
@@ -112,7 +112,7 @@ func (p *HTTP1Protocol) Analyze(connection *PartitionConnection, _ *AnalyzeHelpe
result = enums.ParseResultSkipPackage
}
if err != nil {
- http1Log.Warnf("failed to handle HTTP/1.x protocol, connection ID: %d, random ID: %d, data id: %d, type: %d, error: %v",
+ http1Log.Debugf("failed to handle HTTP/1.x protocol, connection ID: %d, random ID: %d, data id: %d, type: %d, error: %v",
metrics.ConnectionID, metrics.RandomID, buf.Position().DataID(), messageType, err)
}
diff --git a/pkg/profiling/task/network/analyze/layer7/protocols/http1/reader/reader.go b/pkg/profiling/task/network/analyze/layer7/protocols/http1/reader/reader.go
index 6b4fb2a..f5100fb 100644
--- a/pkg/profiling/task/network/analyze/layer7/protocols/http1/reader/reader.go
+++ b/pkg/profiling/task/network/analyze/layer7/protocols/http1/reader/reader.go
@@ -20,6 +20,7 @@ package reader
import (
"bufio"
"compress/gzip"
+ "errors"
"fmt"
"io"
"mime"
@@ -275,15 +276,16 @@ func (m *MessageOpt) checkBodyWithSize(buf *buffer.Buffer, reader *bufio.Reader,
if readSize > len(m.Reader().bodyBuffer) {
readSize = len(m.Reader().bodyBuffer)
}
- lastReadSize, err = reader.Read(m.Reader().bodyBuffer[0:readSize])
+ lastReadSize, err = io.ReadFull(reader, m.Reader().bodyBuffer[0:readSize])
if err != nil {
- if err == buffer.ErrNotComplete {
+ if errors.Is(err, buffer.ErrNotComplete) {
return nil, enums.ParseResultSkipPackage, nil
}
- if err == io.EOF && reduceSize-lastReadSize <= 0 {
+ if (err == io.EOF || errors.Is(err, io.ErrUnexpectedEOF)) && reduceSize-lastReadSize <= 0 {
return nil, enums.ParseResultSuccess, nil
}
- return nil, enums.ParseResultSkipPackage, err
+
+ return nil, enums.ParseResultSkipPackage, fmt.Errorf("reading the body error: %v", err)
}
reduceSize -= lastReadSize
}