Nfs – Stale NFS fila handle error with log4j

log-filesnfs

We have a few instances of a java program running independently but writing to the same log file.

Infrequently we got Stale NFS file handle error when log file was being rotated and written by multiple process instances.

We are now thinking of having separate log file per instance. Has anybody already got this issue and has a better fix.

Thanks Nayn

Best Answer

Don't forget that NFS is not a POSIX compliant filesystem. It is very close to POSIX compliance, which is what people usually trip up on. One of the areas which expose it's non conformance is around deleting and renaming files and especially directories.

My advice is to avoid, unless the application is specifically coded to work with NFS, having two remote processes access the same file on an NFS volume.