Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3806867

Browse files
committed
Merge branch 'main' into mes/filter-work-2
2 parentsd40167f +9102256 commit3806867

File tree

94 files changed

+3099
-623
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+3099
-623
lines changed

‎.github/workflows/ci.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ jobs:
186186
187187
# Check for any typos
188188
-name:Check for typos
189-
uses:crate-ci/typos@v1.24.3
189+
uses:crate-ci/typos@v1.24.5
190190
with:
191191
config:.github/workflows/typos.toml
192192

‎.github/workflows/contrib.yaml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ on:
1313
-opened
1414
-reopened
1515
-edited
16+
# For jobs that don't run on draft PRs.
17+
-ready_for_review
1618

1719
# Only run one instance per PR to ensure in-order execution.
1820
concurrency:pr-${{ github.ref }}
@@ -52,7 +54,7 @@ jobs:
5254
release-labels:
5355
runs-on:ubuntu-latest
5456
# Skip tagging for draft PRs.
55-
if:${{ github.event_name == 'pull_request_target' &&success() &&!github.event.pull_request.draft }}
57+
if:${{ github.event_name == 'pull_request_target' && !github.event.pull_request.draft }}
5658
steps:
5759
-name:release-labels
5860
uses:actions/github-script@v7

‎agent/agent.go‎

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1357,7 +1357,7 @@ func (a *agent) runCoordinator(ctx context.Context, conn drpc.Conn, network *tai
13571357
deferclose(errCh)
13581358
select {
13591359
case<-ctx.Done():
1360-
err:=coordination.Close()
1360+
err:=coordination.Close(a.hardCtx)
13611361
iferr!=nil {
13621362
a.logger.Warn(ctx,"failed to close remote coordination",slog.Error(err))
13631363
}
@@ -1676,13 +1676,12 @@ func (a *agent) manageProcessPriority(ctx context.Context, debouncer *logDebounc
16761676
}
16771677

16781678
score,niceErr:=proc.Niceness(a.syscaller)
1679-
ifniceErr!=nil&&!xerrors.Is(niceErr,os.ErrPermission) {
1679+
if!isBenignProcessErr(niceErr) {
16801680
debouncer.Warn(ctx,"unable to get proc niceness",
16811681
slog.F("cmd",proc.Cmd()),
16821682
slog.F("pid",proc.PID),
16831683
slog.Error(niceErr),
16841684
)
1685-
continue
16861685
}
16871686

16881687
// We only want processes that don't have a nice value set
@@ -1696,7 +1695,7 @@ func (a *agent) manageProcessPriority(ctx context.Context, debouncer *logDebounc
16961695

16971696
ifniceErr==nil {
16981697
err:=proc.SetNiceness(a.syscaller,niceness)
1699-
iferr!=nil&&!xerrors.Is(err,os.ErrPermission) {
1698+
if!isBenignProcessErr(err) {
17001699
debouncer.Warn(ctx,"unable to set proc niceness",
17011700
slog.F("cmd",proc.Cmd()),
17021701
slog.F("pid",proc.PID),
@@ -1710,7 +1709,7 @@ func (a *agent) manageProcessPriority(ctx context.Context, debouncer *logDebounc
17101709
ifoomScore!=unsetOOMScore&&oomScore!=proc.OOMScoreAdj&&!isCustomOOMScore(agentScore,proc) {
17111710
oomScoreStr:=strconv.Itoa(oomScore)
17121711
err:=afero.WriteFile(a.filesystem,fmt.Sprintf("/proc/%d/oom_score_adj",proc.PID), []byte(oomScoreStr),0o644)
1713-
iferr!=nil&&!xerrors.Is(err,os.ErrPermission) {
1712+
if!isBenignProcessErr(err) {
17141713
debouncer.Warn(ctx,"unable to set oom_score_adj",
17151714
slog.F("cmd",proc.Cmd()),
17161715
slog.F("pid",proc.PID),
@@ -2146,3 +2145,14 @@ func (l *logDebouncer) log(ctx context.Context, level slog.Level, msg string, fi
21462145
}
21472146
l.messages[msg]=time.Now()
21482147
}
2148+
2149+
funcisBenignProcessErr(errerror)bool {
2150+
returnerr!=nil&&
2151+
(xerrors.Is(err,os.ErrNotExist)||
2152+
xerrors.Is(err,os.ErrPermission)||
2153+
isNoSuchProcessErr(err))
2154+
}
2155+
2156+
funcisNoSuchProcessErr(errerror)bool {
2157+
returnerr!=nil&&strings.Contains(err.Error(),"no such process")
2158+
}

‎agent/agent_test.go‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1896,7 +1896,9 @@ func TestAgent_UpdatedDERP(t *testing.T) {
18961896
coordinator,conn)
18971897
t.Cleanup(func() {
18981898
t.Logf("closing coordination %s",name)
1899-
err:=coordination.Close()
1899+
cctx,ccancel:=context.WithTimeout(testCtx,testutil.WaitShort)
1900+
deferccancel()
1901+
err:=coordination.Close(cctx)
19001902
iferr!=nil {
19011903
t.Logf("error closing in-memory coordination: %s",err.Error())
19021904
}
@@ -2384,7 +2386,9 @@ func setupAgent(t *testing.T, metadata agentsdk.Manifest, ptyTimeout time.Durati
23842386
clientID,metadata.AgentID,
23852387
coordinator,conn)
23862388
t.Cleanup(func() {
2387-
err:=coordination.Close()
2389+
cctx,ccancel:=context.WithTimeout(testCtx,testutil.WaitShort)
2390+
deferccancel()
2391+
err:=coordination.Close(cctx)
23882392
iferr!=nil {
23892393
t.Logf("error closing in-mem coordination: %s",err.Error())
23902394
}

‎agent/agentproc/proc_unix.go‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,15 @@ func List(fs afero.Fs, syscaller Syscaller) ([]*Process, error) {
4545

4646
cmdline,err:=afero.ReadFile(fs,filepath.Join(defaultProcDir,entry,"cmdline"))
4747
iferr!=nil {
48-
varerrNo syscall.Errno
49-
ifxerrors.As(err,&errNo)&&errNo==syscall.EPERM {
48+
ifisBenignError(err) {
5049
continue
5150
}
5251
returnnil,xerrors.Errorf("read cmdline: %w",err)
5352
}
5453

5554
oomScore,err:=afero.ReadFile(fs,filepath.Join(defaultProcDir,entry,"oom_score_adj"))
5655
iferr!=nil {
57-
ifxerrors.Is(err,os.ErrPermission) {
56+
ifisBenignError(err) {
5857
continue
5958
}
6059

@@ -124,3 +123,12 @@ func (p *Process) Cmd() string {
124123
func (p*Process)cmdLine() []string {
125124
returnstrings.Split(p.CmdLine,"\x00")
126125
}
126+
127+
funcisBenignError(errerror)bool {
128+
varerrno syscall.Errno
129+
if!xerrors.As(err,&errno) {
130+
returnfalse
131+
}
132+
133+
returnerrno==syscall.ESRCH||errno==syscall.EPERM||xerrors.Is(err,os.ErrNotExist)
134+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp