The following reply was made to PR bin/178664; it has been noted by GNATS. From: Jilles Tjoelker <jil...@stack.nl> To: bug-follo...@freebsd.org, kwia...@panic.pl Cc: Subject: Re: bin/178664: truss(1) may kill process Date: Sun, 19 May 2013 14:09:32 +0200
In PR bin/178664, you wrote: > [attaching truss(1) may terminate sleep(1) early] What actually happens is that the nanosleep(2) system call fails with [EINTR] immediately when the debugger (ptrace(2)) attaches. You can verify this using ktrace(1). This is really a longstanding known bug, although I don't know where it is documented. It is longstanding because it is very hard to fix. The kernel wants threads to return to the kernel-userspace boundary when a debugger attaches, and this causes the state of the in-progress system call to be lost. The effect is much like a signal with SA_RESTART set. If you care about sleep(1) itself, that is easy to fix. It already continues the sleep when nanosleep(2) was interrupted by SIGINFO; this can be extended to any [EINTR] error. A workaround is to use ktrace(1) instead of truss(1) or strace(1) from ports. ktrace(1) generally affects the traced program much less. -- Jilles Tjoelker _______________________________________________ freebsd-bugs@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-bugs To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"