Date: Thu, 25 Jan 2007 13:10:24 GMT From: "Joerg Lehners" <Joerg.Lehners@Informatik.Uni-Oldenburg.DE> To: freebsd-bugs@FreeBSD.org Subject: kern/107109: [nfs] Netbeans/Eclipse/Java provoke deadlocks when used with NFS Message-ID: <200701251310.l0PDAOaa062865@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/107109; it has been noted by GNATS. From: "Joerg Lehners" <Joerg.Lehners@Informatik.Uni-Oldenburg.DE> To: bug-followup@FreeBSD.org Cc: Subject: kern/107109: [nfs] Netbeans/Eclipse/Java provoke deadlocks when used with NFS Date: Thu, 25 Jan 2007 13:57:40 +0100 (MET) I have experimented further and narrowed down the problem somewhat. In the meantime I upgraded to FreeBSD 6.2-STABLE as of 8. Jan 2007 and Java 1.5.0 p4 (patchkit 4 from a few days ago). I got someone to wrote a short Java program for me (thanks to Felix Kronlage!) that is able to provoke the problem more easily than with Netbeans and 'do this and than that and ...'. With the program running the Java process locks up after a few seconds of running it, sometime it takes longer. As I suspected initially it is the intermixed fork()ing and stat()ing of NFS files/directories in different threads and some other magic. I tried the Java program with Java 1.5.0 for FreeBSD (patchkit 4), which locks up after some seconds. With Java 1.5.0 for Linux the program crashes after some seconds with some HotSpot error (which is not uncommon for Java 1.5.0 for Linux on FreeBSD 6). With Java 1.6.0 for Linux the program ran for many minutes without any crashes or lockups jet. I also tried Java 1.4.2 for FreeBSD (built from Java SCSL source code with patchkit 8): no crashes or lockups even after many minutes of running. So there seems to be some magic in Java 1.5.0 for FreeBSD (built from Java SCSL source code with at least patchkit p3 and p4) that provoke some deadlock in the kernel when threads do execute fork() and stat() on NFS files/directories intermixed. In the program NFSStressTest.java the variable 'directories' must list some directories that are accessible via NFS. --- NFSStressTest.java begins here --- import java.io.*; public class NFSStressTest { public static void main(String[] args) { int intervall= 1000; boolean debug= true; String[] directories = { "/user/admin/joerg/Src/%Archiv", "/user/admin/joerg/Src/%DONE", "/user/admin/joerg/Bin" }; String[] commands = { "/bin/echo 'hallo'", "/bin/ls /tmp" , "/sbin/md5 /bin/ls" }; IOMaker[] ioMakers= new IOMaker[directories.length]; CMDMaker[] cmdMakers= new CMDMaker[commands.length]; for(int i=0;i<directories.length;i++) { ioMakers[i]= new IOMaker(directories[i], intervall); ioMakers[i].setDebug(false); ioMakers[i].start(); } for(int i=0;i<commands.length;i++) { cmdMakers[i]= new CMDMaker(commands[i], intervall); cmdMakers[i].setDebug(true); cmdMakers[i].start(); } } } class IOMaker extends Thread { private String directory; private int intervall; private boolean debug= false; IOMaker(String directory) { this.directory= directory; } IOMaker(String directory, int intervall) { this.directory= directory; this.intervall= intervall; } void setDebug(boolean debug) { this.debug= debug; } public void run() { File myDirectory= new File(this.directory); while(true) { File[] myFiles= myDirectory.listFiles(); if(myFiles == null) break; for(int i=0;i<myFiles.length;i++) { String absolutePath= myFiles[i].getAbsolutePath(); long lastModified= myFiles[i].lastModified(); if(this.debug) { System.out.println(this +": " + absolutePath +" : " + lastModified); } } Thread.yield(); try { Thread.sleep(this.intervall); } catch (Exception e) { System.out.println("Caught exception: " + e.getMessage()); e.printStackTrace(); } } } } class CMDMaker extends Thread { private String command; private int intervall; private boolean debug= false; CMDMaker(String command, int intervall) { this.command= command; this.intervall= intervall; } void setDebug(boolean debug) { this.debug= debug; } public void run() { while(true) { try { if(this.debug) { System.out.println("command: " + this.command); } Runtime.getRuntime().exec(this.command); } catch (IOException e) { System.out.println("Caught exception in CMDMaker ("+ this.command + ": "+ e.getMessage()); e.printStackTrace(); } Thread.yield(); try { Thread.sleep(this.intervall); } catch (Exception e) { System.out.println("Caught exception: " + e.getMessage()); e.printStackTrace(); } } } } --- NFSStressTest.java ends here --- -- Mail: Joerg.Lehners@Informatik.Uni-Oldenburg.DE Tel: 2198 Real: Joerg Lehners, Informatik ARBI, Uni Oldenburg, D-26111 Oldenburg Unwoerter: Kostensenkung - Gewinnmaximierung - billig, billig, billig
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200701251310.l0PDAOaa062865>