determining open Pipes

T

Thomas Peter

hi,
when i look at my running java program with lsof under solaris i see a
lot of open pipes like:
java 330 username 765u FIFO 0x374ad6ab4c0 0t0 7141660
(fifofs) PIPE->0x374ad6ab5c0

the longer the program runs the more open pipes i get.
i do a lot of runtime.exec calls but do consume and close all streams in
seperate threads.

do you have any hints to determine what leaves this pipe open, or any
tools that can do this for me?

beside the runtime.exec() calls i do call JNI libs as often as .exec().
can there be an issue?

i'm helpless, so any hints are appreciated
cheers,
thomas
 
C

Chris Uppal

Thomas said:
the longer the program runs the more open pipes i get.
i do a lot of runtime.exec calls but do consume and close all streams in
seperate threads.

You probably have this covered already, but just to be sure: are you closing
all three streams (stdin, stdout, and stderr) for each exec(), its easy to
forget to close the input if you are not using it.

Failing that, you could run your Java program under a debugger whilst
simultaneously using OS-level tracing tools (perhaps even ptrace, or whatever
its called these days). Stepping through the code in the debugger would show
what operations create pipes which are never closed, so you should be able to
pin down the problem that way.

JNI probably shouldn't be an issue unless you are explicitly creating fifos, or
are using popen(), in JNI code -- and I presume that you'd know if you were
doing that.

-- chris
 
T

Thomas Peter

Chris said:
You probably have this covered already, but just to be sure: are you closing
all three streams (stdin, stdout, and stderr) for each exec(), its easy to
forget to close the input if you are not using it.

yes, i do close the stdoutput (java point of view) stream in a seperate
thread.
Failing that, you could run your Java program under a debugger whilst
simultaneously using OS-level tracing tools (perhaps even ptrace, or whatever
its called these days). Stepping through the code in the debugger would show
what operations create pipes which are never closed, so you should be able to
pin down the problem that way.

ok, going the long way. :)
JNI probably shouldn't be an issue unless you are explicitly creating fifos, or

are using popen(), in JNI code -- and I presume that you'd know if you were
doing that.

it's a third-party jni lib, but i'll have a look at that. but i hardly
know nothing about c/jni.

thanx,
thomas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,522
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top