Skip to content

Commit cf7bc37

Browse files
author
LeeGunhee
committed
add some defense code
1 parent 67ff775 commit cf7bc37

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

scouterx/common/netdata/dataoutputx.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ func (out *DataOutputX) WriteString(value string) (*DataOutputX, error) {
175175
var err error
176176
if length == 0 {
177177
_, err = out.WriteInt8(0)
178+
} else if length > 100000 {
179+
err = out.WriteBlob([]byte("huge string omitted..."))
178180
} else {
179181
err = out.WriteBlob([]byte(value))
180182
}

scouterx/strace/tracemain.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ import (
44
"context"
55
"fmt"
66
"github.com/scouter-contrib/scouter-agent-golang/scouterx/common"
7+
"github.com/scouter-contrib/scouter-agent-golang/scouterx/common/netdata"
8+
"github.com/scouter-contrib/scouter-agent-golang/scouterx/common/util"
79
"github.com/scouter-contrib/scouter-agent-golang/scouterx/common/util/keygen"
810
"github.com/scouter-contrib/scouter-agent-golang/scouterx/conf"
911
"github.com/scouter-contrib/scouter-agent-golang/scouterx/counter"
1012
"github.com/scouter-contrib/scouter-agent-golang/scouterx/netio"
1113
"github.com/scouter-contrib/scouter-agent-golang/scouterx/netio/tcpclient"
1214
"github.com/scouter-contrib/scouter-agent-golang/scouterx/strace/tctxmanager"
13-
"github.com/scouter-contrib/scouter-agent-golang/scouterx/common/netdata"
14-
"github.com/scouter-contrib/scouter-agent-golang/scouterx/common/util"
1515
"net/http"
1616
"runtime"
1717
"strconv"
@@ -356,6 +356,7 @@ func endAnyService(ctx context.Context) {
356356
}
357357

358358
func endStuckServiceForcibly(tctx *netio.TraceContext) {
359+
defer common.ReportScouterPanic()
359360
if ac.StuckServiceRemoveEnabled {
360361
step := netdata.NewPMessageStep(util.MillisToNow(tctx.StartTime))
361362
step.SetMessage(netio.SendHashedMessage("Service currently may running, not finished!"))

0 commit comments

Comments
 (0)