Monday, September 24, 2007

Solving too many open named pipes in a java process

Too many open named pipes in a java process...


Too many open named pipes in a java process..

In a java process (that uses JNI and socket communications), I get "Too
many open files" error.

When debugging further using lsof or pfiles, (with the process id), I
saw many named pipes (FIFO) in open state.

lsof:
jsvc 10805 userid 951w FIFO 0,6 2989015 pipe
jsvc 10805 userid 952w FIFO 0,6 2988104 pipe
jsvc 10805 userid 953w FIFO 0,6 2989588 pipe
jsvc 10805 userid 954w FIFO 0,6 2988290 pipe
jsvc 10805 userid 955w FIFO 0,6 2988626 pipe

there are more than 500 processes opened.

Obviously there might have some streams I didn't close.

And the usage of Runtime.exec() will also cause the pipe here. The inputstream, outstream, errorstream should be closed.

2 comments:

Anonymous said...

Genial post and this enter helped me alot in my college assignement. Say thank you you as your information.

Anonymous said...

Sorry for my bad english. Thank you so much for your good post. Your post helped me in my college assignment, If you can provide me more details please email me.