From owner-freebsd-hackers@FreeBSD.ORG Fri Jun 29 20:16:59 2012 Return-Path: Delivered-To: freebsd-hackers@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EB8091065695 for ; Fri, 29 Jun 2012 20:16:58 +0000 (UTC) (envelope-from yuri@rawbw.com) Received: from shell0.rawbw.com (shell0.rawbw.com [198.144.192.45]) by mx1.freebsd.org (Postfix) with ESMTP id CDCD28FC19 for ; Fri, 29 Jun 2012 20:16:58 +0000 (UTC) Received: from eagle.yuri.org (stunnel@localhost [127.0.0.1]) (authenticated bits=0) by shell0.rawbw.com (8.14.4/8.14.4) with ESMTP id q5TKGndl001896 for ; Fri, 29 Jun 2012 13:16:51 -0700 (PDT) (envelope-from yuri@rawbw.com) Message-ID: <4FEE0D2F.4010808@rawbw.com> Date: Fri, 29 Jun 2012 13:16:47 -0700 From: Yuri User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:13.0) Gecko/20120625 Thunderbird/13.0.1 MIME-Version: 1.0 To: freebsd-hackers@FreeBSD.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Subject: System is flooded with failed read(2) calls: Resource temporarily unavailable (errno=35) coming from xorg unix socket X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jun 2012 20:16:59 -0000 When I run dtrace script (attached) on 9.0 amd64 with kde4 I see a lot of failed read(2) calls from the xorg socket /tmp/.X11-unix/X0 . This can't be right in my opinion. This means that code keeps reading from this socket and failing, instead of using select(2) or kquere(2). Requests mostly come from kdeinit4 but some also from kwin, chrome and even Xorg itself. Rate of failure for read(2) calls is ~2500/sec systemwide. This is of course not a deadly problem. But is this situation considered to be normal? Yuri --- dtrace script--- !/usr/bin/perl use Getopt::Std; # # Defaults # $FILTER = ""; $COUNT = 0; # # Command line arguments # &Usage() if $ARGV[0] eq "--help"; getopts('ch:n:p:') || &Usage(); &Usage() if $opt_h; $COUNT = 1 if $opt_c; $FILTER = "&& execname == \"$opt_n\"" if defined $opt_n; $FILTER = "&& pid == $opt_p" if defined $opt_p; # # Load errno descriptions # open(ERRNO,"/usr/include/sys/errno.h") || die "ERROR1: reading errno.h: $!\n"; while (chomp($line = )) { next unless $line =~ /^#define/; ($errno,$desc) = $line =~ /^#define\s+\S+\s+(\d+)\s+\/\*(.*)\*\//; $Errno{$errno} = $desc; } close ERRNO; # # Declare DTrace script # if ($COUNT) { # aggregate style $dtrace = <fd = arg0; } syscall::read:return /errno != 0 && pid != \$pid $FILTER/ { printf("%d %s %s %d\\n", pid, execname, probefunc, errno); printf("fd=%d\\n",self->fd); }' END } # # Cleanup on signals # $SIG{INT} = \&Cleanup_Signal; # Ctrl-C $SIG{QUIT} = \&Cleanup_Signal; # Ctrl-\ $SIG{TERM} = \&Cleanup_Signal; # TERM # # Run DTrace, process output # if ($COUNT) { print STDERR "Sampling... Hit Ctrl-C to end.\n"; $header = 1; } else { printf("%16s %16s %4s %s\n","EXEC","SYSCALL","ERR","DESC"); } ### Open DTrace open(DTRACE,"$dtrace |") || die "ERROR2: Can't start dtrace (perms?): $!\n"; ### Process DTrace output while (chomp($line = )) { ### Print count header if ($COUNT && $header) { printf("\n%16s %16s %16s %4s %6s %s\n", "PID", "EXEC","SYSCALL","ERR","COUNT","DESC"); $header = 0; } ### Split data ($pid,$execname,$syscall,$errno,$counts) = split(' ',$line); if ($errno eq "") {printf("DESCR %s\n", $line);} next if $errno eq ""; ### Fetch errno description $desc = $Errno{$errno}; ### Print output line if ($COUNT) { printf("%16s %16s %16s %4d %6d %s\n", $pid, $execname,$syscall,$errno,$counts,$desc); } else { printf("%16s %16s %16s %4d %s\n",$pid,$execname,$syscall,$errno,$desc); } } close(DTRACE); # # Triggered by signals # sub Cleanup_Signal { } # # Usage message # sub Usage { print STDERR "USAGE: errinfo [-ch] [-p PID] [-n name]\n"; print STDERR <