[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Interrupted stat() calls
From: |
Reid Madsen |
Subject: |
Interrupted stat() calls |
Date: |
Wed, 28 Nov 2001 17:30:57 -0600 (CST) |
We've been noticing that when GNUmake is used on systems
that are heavily loaded, that GNUmake will occasionally
complain about not being able to find an existing file
that is required by some target:
No rule to make target 'xxx', needed by 'yyy'
This is occuring on both HP, and Solaris, machines,
on a regular basis.
We've traced this down to the fact that stat() calls
can be interrupted. However, in most of the places
where stat() is called in the GNUmake source, it does
not handle the EINTR error that might occur.
When the stat() call is interrupted, GNUmake reports
the above error and exits.
This problem has been exacerbated in Solaris 2.8 due
to a bug in the Solaris 2.8 kernel. This bug can
cause stat calls to take 1, to 2, orders of magnitude
longer than normal -- pretty much guaranteeing that
some stat() call somewhere will be interrupted by
SIGCHILD when one of GNUmake's children terminates.
Our solution to this problem was to replace every
stat() with a do_stat() function that handles the
EINTER error code. This is what it looks like:
int do_stat(const char *path, struct stat *buf)
{
int ret, retry;
if((ret=stat(path, buf)) != 0) {
if(errno == EINTR) {
retry=0;
while(retry++ < 10 && ret != 0 && errno == EINTR) {
ret=stat(path, buf);
}
}
}
return(ret);
}
With this workaround in place, GNUmake never reports
the above error for existing files.
Please consider incorporating this, or something better,
in the next release.
As far as the Solaris 2.8 bug goes, it has been escalated
to the highest levels in Sun. We expect a patch for the
problem in December/January.
Regards,
Reid Madsen
--
Reid Madsen address@hidden
Senior Member, Tech. Staff (469) 357-8389 (Desk)
I2 Technologies
--
On a crusade to eliminate dead code ...
- Interrupted stat() calls,
Reid Madsen <=