On Wed, 2001-10-03 at 05:37, Jeff Singer wrote: > > I’m still not sure exactly what you meant with the open file issue. > If the open file is counted one per thread, is the file open for each > thread or only reported as open. If so lsof might not be accurate with > threads ??
That's correct, lsof is walking the process list and counting open file handles per process. It doesn't know, for example, that process 14678 and process 14679 are really two threads created from the same Java process 14674. Try something like this: ========== import java.io.*; public class foo { public static void main(String[] args) { // Open one file FileReader fr = new FileReader("foo.java"); while (true) { // For every chracter typed in stdin ... System.in.read(); // ... start a thread that does nothing but sleeping new Thread() { public void run() { try { Thread.sleep(60000); } catch (InterruptedException e) { } } }.start(); } } } ========== In this program, you know you are opening only one file. Afterwards, you are creating threads without doing anything. Run this program in one window and watch the open file count of foo.java in another window. You will see that the count goes up as the number of threads goes up. This is by no means a Java issue. If you write a pthreads C program similar to the above, you will observe the same thing. > The reason we started looking at the open files is, we where having IO > problems. After running for about 1 day, Linix started reporting IO errors > and stating that it couldn’t open any more files. The problem might lie elsewhere. You can do a strace on the Java process to figure out where and when files are opened. > > The other concern or question is, should the handle to a referenced jar file > not be closed at some point? My understanding is that each jar file is opened, mmap-ed and then closed. So lsof will report the jar files to be open by the Java process but that shouldn't take up a slot in the file handle table. (I haven't looked at the source code of the JDK, so someone please correct me if I'm wrong.) -- Weiqi Gao [EMAIL PROTECTED] ---------------------------------------------------------------------- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]