Hi Doug,
sigar_file_system_usage_get() is using statvfs() which blocks on a stale
NFS mounts.
$ mount 10.0.0.1:/nfs/path /mnt/nfs/
shut down nfs-server
$ sigar-test-all
will hang in statvfs().
To fix the hang you may have to use:
fd = open(..., O_RDONLY | O_NONBLOCK);
if (fd == -1) ...
fstatvfs(fd, ...);
open() will (hopefully) fail if it can't get a lock on the file.
I have not tested this yet, but it points into the right direction.
cheers,
Jan
--
Jan Kneschke, Enterprise Tools Dev, MySQL GmbH,
D-81373 München, Radlkoferstr. 2, GF: Kaj Arnö - HRB München 162140
Hi Jan,I haven't tried this, but as John pointed out, it is unlikely to help. The Java api has a getMountedFileSystemUsage method which checks that the nfs server is reachable via rpc ping. If the ping fails, don't attempt to get the stats, avoiding the hang. I can move this to the C api if you're interested.On May 7, 2007, at 8:50 AM, Jan Kneschke wrote:Hi Doug,
sigar_file_system_usage_get() is using statvfs() which blocks on a stale
NFS mounts.
$ mount 10.0.0.1:/nfs/path /mnt/nfs/
shut down nfs-server
$ sigar-test-all
will hang in statvfs().
To fix the hang you may have to use:
fd = open(..., O_RDONLY | O_NONBLOCK);
if (fd == -1) ...
fstatvfs(fd, ...);
open() will (hopefully) fail if it can't get a lock on the file.
I have not tested this yet, but it points into the right direction.
cheers,
Jan
--
Jan Kneschke, Enterprise Tools Dev, MySQL GmbH,
D-81373 München, Radlkoferstr. 2, GF: Kaj Arnö - HRB München 162140