System is flooded with failed read(2) calls: Resource temporarily
unavailable (errno=35) coming from xorg unix socket
Yuri
yuri at rawbw.com
Fri Jun 29 20:16:59 UTC 2012
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 = <ERRNO>)) {
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 = <<END;
/usr/sbin/dtrace -n '
#pragma D option quiet
syscall:::return
/errno != 0 && pid != \$pid $FILTER/
{
\@Errs[execname, probefunc, errno] = count();
}
dtrace:::END {
printa("%s %s %d %\@d\\n", \@Errs);
}'
END
} else { # snoop style
$dtrace = <<END;
/usr/sbin/dtrace -n '
#pragma D option quiet
#pragma D option switchrate=5hz
syscall::read:entry
{
self->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 = <DTRACE>)) {
### 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 <<ENDUSAGE;
eg,
errinfo # default output - snoop event style
-c # counts - aggregate style
-p 871 # examine PID 871 only
-n ssh # examine processes with the name "ssh" only
-cn ssh # examine "ssh" using counts
ENDUSAGE
exit(1);
}
More information about the freebsd-hackers
mailing list