proc: bugfix: intermittent failures of TestRestart_afterExit
During process termination we seem to receive notifications of new threads that die before we can add them, ignore them
This commit is contained in:
parent
d81482c820
commit
bba999b985
@ -116,6 +116,9 @@ func (dbp *Process) addThread(tid int, attach bool) (*Thread, error) {
|
||||
return nil, fmt.Errorf("error while waiting after adding thread: %d %s", tid, err)
|
||||
}
|
||||
dbp.execPtraceFunc(func() { err = syscall.PtraceSetOptions(tid, syscall.PTRACE_O_TRACECLONE) })
|
||||
if err == syscall.ESRCH {
|
||||
return nil, err
|
||||
}
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not set options for new traced thread %d %s", tid, err)
|
||||
}
|
||||
@ -265,9 +268,18 @@ func (dbp *Process) trapWait(pid int) (*Thread, error) {
|
||||
}
|
||||
th, err = dbp.addThread(int(cloned), false)
|
||||
if err != nil {
|
||||
if err == sys.ESRCH {
|
||||
// thread died while we were adding it
|
||||
continue
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
if err = th.Continue(); err != nil {
|
||||
if err == sys.ESRCH {
|
||||
// thread died while we were adding it
|
||||
delete(dbp.Threads, th.Id)
|
||||
continue
|
||||
}
|
||||
return nil, fmt.Errorf("could not continue new thread %d %s", cloned, err)
|
||||
}
|
||||
if err = dbp.Threads[int(wpid)].Continue(); err != nil {
|
||||
|
@ -83,7 +83,7 @@ func TestRestart_afterExit(t *testing.T) {
|
||||
}
|
||||
state = <-c.Continue()
|
||||
if !state.Exited {
|
||||
t.Fatal("expected restarted process to have exited")
|
||||
t.Fatalf("expected restarted process to have exited %v", state)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user