Skip to content

Commit

Permalink
Avoid assert which is now more likely after recent commit.
Browse files Browse the repository at this point in the history
Related: 7ffb7d6
See issue 3504.

$ bin/rr record -n bin/pid_ns_kill_child

Error message:
  [FATAL src/Task.cc:2167:did_waitpid() errno: EDOM]
   (task 285229 (rec:285229) at time 269)
   -> Assertion `!handled_ptrace_exit_event' failed to hold.

rr-debugger#6  rr::EmergencyDebugOstream::~EmergencyDebugOstream (this=this@entry=0x7fffb7babb70, __in_chrg=<optimized out>) at rr/src/log.cc:484
rr-debugger#7  0x000056012f0b167d in rr::Task::did_waitpid (this=this@entry=0x56012f9d4640, status=...) at rr/src/Task.cc:2167
rr-debugger#8  0x000056012f086ac7 in rr::Scheduler::reschedule (this=this@entry=0x56012f9c4188, switchable=<optimized out>) at rr/src/Scheduler.cc:882
rr-debugger#9  0x000056012eff4607 in rr::RecordSession::record_step (this=0x56012f9c3f40) at rr/src/RecordSession.cc:2497
rr-debugger#10 0x000056012efe8664 in rr::record (flags=..., args=...) at rr/src/RecordCommand.cc:697
rr-debugger#11 rr::RecordCommand::run (this=0x56012f207a40 <rr::RecordCommand::singleton>, args=...) at rr/src/RecordCommand.cc:860
rr-debugger#12 0x000056012ef4800f in main (argc=<optimized out>, argv=<optimized out>) at rr/src/main.cc:278

With change in Task.cc:
Error message:
  [FATAL src/Task.cc:3894:did_handle_ptrace_exit_event()]
   (task 308641 (rec:308641) at time 269)
   -> Assertion `!handled_ptrace_exit_event' failed to hold.

rr-debugger#6  rr::EmergencyDebugOstream::~EmergencyDebugOstream (this=this@entry=0x7ffe5e4cdf70, __in_chrg=<optimized out>) at rr/src/log.cc:484
rr-debugger#7  0x000056265d0981b7 in rr::Task::did_handle_ptrace_exit_event (this=this@entry=0x56265dde3640) at rr/src/Task.cc:3894
rr-debugger#8  0x000056265cfdb110 in rr::handle_ptrace_exit_event (t=t@entry=0x56265dde3640) at rr/src/RecordSession.cc:279
rr-debugger#9  0x000056265cfe272b in rr::RecordSession::record_step (this=0x56265ddd2f40) at rr/src/RecordSession.cc:2535
rr-debugger#10 0x000056265cfd6674 in rr::record (flags=..., args=...) at rr/src/RecordCommand.cc:697
rr-debugger#11 rr::RecordCommand::run (this=0x56265d1f5a40 <rr::RecordCommand::singleton>, args=...) at rr/src/RecordCommand.cc:860
rr-debugger#12 0x000056265cf3601f in main (argc=<optimized out>, argv=<optimized out>) at rr/src/main.cc:278
  • Loading branch information
bernhardu committed Apr 22, 2023
1 parent 6008ae7 commit ca88d20
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/RecordSession.cc
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ static bool looks_like_syscall_entry(RecordTask* t) {
* true, t has been deleted and cannot be referenced again.
*/
static bool handle_ptrace_exit_event(RecordTask* t) {
if (t->already_reaped()) {
if (t->already_reaped() || t->already_exited()) {
t->did_reach_zombie();
return true;
}
Expand Down
4 changes: 3 additions & 1 deletion src/Task.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2164,7 +2164,9 @@ void Task::did_waitpid(WaitStatus status) {
ticks += more_ticks;

if (status.ptrace_event() == PTRACE_EVENT_EXIT) {
ASSERT(this, !handled_ptrace_exit_event);
if (!already_exited()) {
ASSERT(this, !handled_ptrace_exit_event);
}
seen_ptrace_exit_event = true;
if (already_reaped()) {
// NB: It's possible for us to have already reaped in the
Expand Down

0 comments on commit ca88d20

Please sign in to comment.