Subject: kern/18807: ktruss cannot keep up with some processes
To: None <gnats-bugs@gnats.netbsd.org>
From: Christian Biere <christianbiere@gmx.de>
List: netbsd-bugs
Date: 10/26/2002 09:04:15
>Number:         18807
>Category:       kern
>Synopsis:       ktruss cannot keep up with some processes
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Oct 26 00:05:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Christian Biere
>Release:        NetBSD 1.6J
>Organization:
       
>Environment:
System: NetBSD localhost 1.6J NetBSD 1.6J (GENERIC) #1: Sat Oct 26
07:22:10 CEST 2002    
root@localhost:/usr/src/sys/arch/i386/compile/GENERIC i386 
Architecture: i386 
Machine: i386

>Description:

ktruss fails with some processes which produce many system-calls very
frequently. I've encountered this when I wanted to ktruss
/usr/pkgsrc/emulators/generator but I've seen this with other programs
before (I just cannot remember a good example, maybe "find /"?). I have
changed ktrwrite() so that it doesn't give up after 3 failures with
EWOULDBLOCK. I'm not sure whether this is a clever idea but I haven't
experienced problems with this so far.

>How-To-Repeat:

ktruss find /

(This might depend on cpu and io speed.)

>Fix:
--Multipart_Sat__26_Oct_2002_09:04:15_+0200_081fa000
Content-Type: text/plain;
 name="kern_ktrace.c.udif"
Content-Disposition: attachment;
 filename="kern_ktrace.c.udif"
Content-Transfer-Encoding: 7bit

Index: kern_ktrace.c
===================================================================
RCS file: /cvsroot/syssrc/sys/kern/kern_ktrace.c,v
retrieving revision 1.59
diff -u -b -r1.59 kern_ktrace.c
--- kern_ktrace.c	2002/10/23 09:14:18	1.59
+++ kern_ktrace.c	2002/10/26 06:55:01
@@ -618,7 +618,7 @@
 		tries++;
 		if (error == EWOULDBLOCK) 
 		  	yield();
-	} while ((error == EWOULDBLOCK) && (tries < 3));
+	} while ((error == EWOULDBLOCK)/* && (tries < 3)*/);
 	FILE_UNUSE(fp, NULL);
 
 	if (__predict_true(error == 0))

--Multipart_Sat__26_Oct_2002_09:04:15_+0200_081fa000--
>Release-Note:
>Audit-Trail:
>Unformatted:
 This is a multi-part message in MIME format.
 
 --Multipart_Sat__26_Oct_2002_09:04:15_+0200_081fa000
 Content-Type: text/plain; charset=US-ASCII
 Content-Transfer-Encoding: 7bit