Skip to content

Commit

Permalink
pkg/prog/native/linux: change handling of ESRCH in trapWaitInternal (g…
Browse files Browse the repository at this point in the history
…o-delve#2286)

If a thread exits while we are looking at it just treat it as if the
status had reported it as exited instead of doing something special.
Fixes flakiness in TestIssue387.
  • Loading branch information
aarzilli authored and zhaixiaojuan committed Apr 25, 2021
1 parent 9c77689 commit cc07f56
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/proc/native/proc_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,10 +398,15 @@ func (dbp *nativeProcess) trapWaitInternal(pid int, options trapWaitOptions) (*n
th.os.running = false
return th, nil
} else if err := th.resumeWithSig(int(status.StopSignal())); err != nil {
if options&trapWaitDontCallExitGuard != 0 {
if err != sys.ESRCH {
return nil, err
}
return nil, dbp.exitGuard(err)
// do the same thing we do if a thread quit
if wpid == dbp.pid {
dbp.postExit()
return nil, proc.ErrProcessExited{Pid: wpid, Status: status.ExitStatus()}
}
delete(dbp.threads, wpid)
}
}
}
Expand Down

0 comments on commit cc07f56

Please sign in to comment.