JDK-5073268 : (process) Process.waitFor does not return when executing "sh -c df "
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 1.4.2_05
  • Priority: P1
  • Status: Closed
  • Resolution: Not an Issue
  • OS: linux_2.4
  • CPU: x86
  • Submitted: 2004-07-13
  • Updated: 2004-07-16
  • Resolved: 2004-07-16
Related Reports
Relates :  
Description
It happens on JDS with JDK 1.4.2_04, JDK 1.4.2_05, JDK 1.5.0 build 57. Directory is in nfs mount. It does not happen on the same folder when run on Solaris 9 or RedHat 9. We need at least some workaround if available. Test case is attached.
###@###.### 2004-07-13

As synopsis is truncated I put here again command (used also in test case):"sh -c df <nfs dir>" example: "sh -c df /home/ms124458".

###@###.### 2004-07-13

Full thread dump Java HotSpot(TM) Client VM (1.4.2_05-b04 mixed mode):
 
"process reaper" daemon prio=1 tid=0x080affa8 nid=0x5be5 runnable [4cc97000..4cc978b8]
        at java.lang.UNIXProcess.waitForProcessExit(Native Method)
        at java.lang.UNIXProcess.access$1500(UNIXProcess.java:20)
        at java.lang.UNIXProcess$2.run(UNIXProcess.java:127)
 
"Signal Dispatcher" daemon prio=1 tid=0x080971f8 nid=0x5be2 waiting on condition [0..0]
 
"Finalizer" daemon prio=1 tid=0x080922e8 nid=0x5be0 in Object.wait() [4c902000..4c9028b8]
        at java.lang.Object.wait(Native Method)
        - waiting on <0x44700490> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:111)
        - locked <0x44700490> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:127)
        at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)
 
"Reference Handler" daemon prio=1 tid=0x080916b0 nid=0x5bdf in Object.wait() [4c881000..4c8818b8]
        at java.lang.Object.wait(Native Method)
        - waiting on <0x44700380> (a java.lang.ref.Reference$Lock)
        at java.lang.Object.wait(Object.java:429)
        at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:115)
        - locked <0x44700380> (a java.lang.ref.Reference$Lock)
 
"main" prio=1 tid=0x0805aa08 nid=0x5bdc in Object.wait() [bfffd000..bfffd3a8]
        at java.lang.Object.wait(Native Method)
        - waiting on <0x4471df10> (a java.lang.UNIXProcess)
        at java.lang.Object.wait(Object.java:429)
        at java.lang.UNIXProcess.waitFor(UNIXProcess.java:160)
        - locked <0x4471df10> (a java.lang.UNIXProcess)
        at Main.main(Main.java:39)
 
"VM Thread" prio=1 tid=0x0808e540 nid=0x5bde runnable
 
"VM Periodic Task Thread" prio=1 tid=0x08099920 nid=0x5be4 waiting on condition
"Suspend Checker Thread" prio=1 tid=0x080967c0 nid=0x5be1 runnable
 

###@###.### 2004-07-13

I tested again and this command does not finish on that machine. (We tested it before but we probably tested only 'mount' on that machine.) You can close this issue.
###@###.### 2004-07-15

Unfortunately it happens again this time on another machine with "sh -c mount" command. In this case it works fine on command line and hangs with java test case. I starts to hang when many nfs automounts from another machine is mounted (more than 40 mounts instead of 10). Please do you have any idea how to diagnose it?
###@###.### 2004-07-15

I can reproduce it also on RH9. First I must mount many mounts so output from mount is long. Then java test hangs even if the same command "mount" from command line works fine.
###@###.### 2004-07-15

I tried "cat tt" where tt is text file of size 8984 bytes. On command line is works, java test hangs. When I cat another smaller file with size 2722 bytes it works. It looks like it depends on size command output. It has nothing to do with nfs. It seems there is some limit where it hangs. (It is completely different from previous df command which did not finish even on command line.)
###@###.### 2004-07-15

Comments
PUBLIC COMMENTS -
20-09-2004

EVALUATION Runtime.exec simply runs other programs. If Process.waitFor() hangs, then it is likely a problem with that program, not with Java. Does running the same command from the command line also hang? This is very likely to be Not Our Bug. "NFS server not responding" has been part of Unix life for decades. ###@###.### 2004-07-14 The submitter's second problem is likely due to the limited and platform-dependent size of the operating system pipe buffer, and the fact that the output of the subprocess command was not drained from the buffer by the java program. This is all explained in gory detail in rfe 5074560. Again, not a bug, but the submitter's confusion is very understandable -- I remember being confused in the same way myself. ###@###.### 2004-07-15 Yes it is as described in rfe 5074560. I tried example code rfe 5074560 and it works without problem. You close this issue again. Problem is in Install Shield. We must solve it somehow. Thanks for explanation. ###@###.### 2004-07-16
16-07-2004