Skip to content

Commit

Permalink
add some defense code
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeGunhee committed Apr 18, 2021
1 parent 67ff775 commit cf7bc37
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions scouterx/common/netdata/dataoutputx.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ func (out *DataOutputX) WriteString(value string) (*DataOutputX, error) {
var err error
if length == 0 {
_, err = out.WriteInt8(0)
} else if length > 100000 {
err = out.WriteBlob([]byte("huge string omitted..."))
} else {
err = out.WriteBlob([]byte(value))
}
Expand Down
5 changes: 3 additions & 2 deletions scouterx/strace/tracemain.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import (
"context"
"fmt"
"github.com/scouter-contrib/scouter-agent-golang/scouterx/common"
"github.com/scouter-contrib/scouter-agent-golang/scouterx/common/netdata"
"github.com/scouter-contrib/scouter-agent-golang/scouterx/common/util"
"github.com/scouter-contrib/scouter-agent-golang/scouterx/common/util/keygen"
"github.com/scouter-contrib/scouter-agent-golang/scouterx/conf"
"github.com/scouter-contrib/scouter-agent-golang/scouterx/counter"
"github.com/scouter-contrib/scouter-agent-golang/scouterx/netio"
"github.com/scouter-contrib/scouter-agent-golang/scouterx/netio/tcpclient"
"github.com/scouter-contrib/scouter-agent-golang/scouterx/strace/tctxmanager"
"github.com/scouter-contrib/scouter-agent-golang/scouterx/common/netdata"
"github.com/scouter-contrib/scouter-agent-golang/scouterx/common/util"
"net/http"
"runtime"
"strconv"
Expand Down Expand Up @@ -356,6 +356,7 @@ func endAnyService(ctx context.Context) {
}

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

0 comments on commit cf7bc37

Please sign in to comment.