@@ -1677,11 +1677,14 @@ func (a *agent) manageProcessPriority(ctx context.Context, debouncer *logDebounc
16771677
16781678score ,niceErr := proc .Niceness (a .syscaller )
16791679if niceErr != nil && ! xerrors .Is (niceErr ,os .ErrPermission ) {
1680- debouncer .Warn (ctx ,"unable to get proc niceness" ,
1681- slog .F ("cmd" ,proc .Cmd ()),
1682- slog .F ("pid" ,proc .PID ),
1683- slog .Error (niceErr ),
1684- )
1680+ if ! isNoSuchProcessErr (niceErr ) {
1681+ debouncer .Warn (ctx ,"unable to get proc niceness" ,
1682+ slog .F ("cmd" ,proc .Cmd ()),
1683+ slog .F ("pid" ,proc .PID ),
1684+ slog .Error (niceErr ),
1685+ )
1686+ }
1687+
16851688continue
16861689}
16871690
@@ -1697,12 +1700,14 @@ func (a *agent) manageProcessPriority(ctx context.Context, debouncer *logDebounc
16971700if niceErr == nil {
16981701err := proc .SetNiceness (a .syscaller ,niceness )
16991702if err != nil && ! xerrors .Is (err ,os .ErrPermission ) {
1700- debouncer .Warn (ctx ,"unable to set proc niceness" ,
1701- slog .F ("cmd" ,proc .Cmd ()),
1702- slog .F ("pid" ,proc .PID ),
1703- slog .F ("niceness" ,niceness ),
1704- slog .Error (err ),
1705- )
1703+ if ! isNoSuchProcessErr (err ) {
1704+ debouncer .Warn (ctx ,"unable to set proc niceness" ,
1705+ slog .F ("cmd" ,proc .Cmd ()),
1706+ slog .F ("pid" ,proc .PID ),
1707+ slog .F ("niceness" ,niceness ),
1708+ slog .Error (err ),
1709+ )
1710+ }
17061711}
17071712}
17081713
@@ -1711,12 +1716,14 @@ func (a *agent) manageProcessPriority(ctx context.Context, debouncer *logDebounc
17111716oomScoreStr := strconv .Itoa (oomScore )
17121717err := afero .WriteFile (a .filesystem ,fmt .Sprintf ("/proc/%d/oom_score_adj" ,proc .PID ), []byte (oomScoreStr ),0o644 )
17131718if err != nil && ! xerrors .Is (err ,os .ErrPermission ) {
1714- debouncer .Warn (ctx ,"unable to set oom_score_adj" ,
1715- slog .F ("cmd" ,proc .Cmd ()),
1716- slog .F ("pid" ,proc .PID ),
1717- slog .F ("score" ,oomScoreStr ),
1718- slog .Error (err ),
1719- )
1719+ if ! isNoSuchProcessErr (err ) {
1720+ debouncer .Warn (ctx ,"unable to set oom_score_adj" ,
1721+ slog .F ("cmd" ,proc .Cmd ()),
1722+ slog .F ("pid" ,proc .PID ),
1723+ slog .F ("score" ,oomScoreStr ),
1724+ slog .Error (err ),
1725+ )
1726+ }
17201727}
17211728}
17221729modProcs = append (modProcs ,proc )
@@ -2146,3 +2153,7 @@ func (l *logDebouncer) log(ctx context.Context, level slog.Level, msg string, fi
21462153}
21472154l .messages [msg ]= time .Now ()
21482155}
2156+
2157+ func isNoSuchProcessErr (err error )bool {
2158+ return err != nil && strings .Contains (err .Error (),"no such process" )
2159+ }