Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
add comment

2 Answers 2

up vote 1 down vote accepted

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.

share|improve this answer
add comment

Yeah, if you delete a file which is open by another host over NFS then you'll see this error.

Separate log files (or using syslog, or not logging to NFS) sounds like the best idea in this case.

share|improve this answer
    
Why should a file get deleted on NFS. The log appenders simply rename the existing one and create new log file. I tried this manually. I started a program which was writing in a log file. I simply renamed the log file while the program was running. It did not crash, but continued to write in the renamed log file. My question is, why should the file get deleted if the Log appenders are not deleting the file. –  Nayn Jan 25 '10 at 8:17
    
Are there any other programs which are rotating or changing the log files? Are there any applications running on the NFS server accessing the log files directly rather than over NFS? What type of NFS server are you using? I'm assuming the clients are Linux? I've found it really hard to replicate the stale NFS file handle problem in test conditions... –  James Jan 25 '10 at 9:23
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.