달력

5

« 2024/5 »

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31

http://suite.tistory.com/

2006 12 20  fs

자바로 스크립트나 바이너리를 실행 시킬때


Process 객체를 사용하는데 이때 실행하다 보면

 =====================================================

      java.io.IOException: Too many open files

        at java.lang.UNIXProcess.forkAndExec(Native Method)
        at java.lang.UNIXProcess.<init>(UNIXProcess.java:84)
        at java.lang.Runtime.execInternal(Native Method)
        at java.lang.Runtime.exec(Runtime.java:566)


      ~~ ~~~
=========================================================


이와 같은 에러 메시지가 나온다.


뭐이런 해결책을 인터넷에 시스템적으로 한프로세스당 파일디스크립터값을 수정한는 것도 있는것같은데

실제로 해보진 않았다.

더 인터넷을 찾아보니 그냥  Process.destroy() 해줘 그냥 초기화 하면  그냥 잘 된다. -.-^


아래는 참고한 구굴링 문서임


http://groups.google.co.kr/group/comp.lang.java.programmer/browse_thread/thread/b18433b07c5c831f/e2757eb8073c7b74?lnk=st&q=Too+many+open+files+Runtime&rnum=1&hl=ko#e2757eb8073c7b74
  Runtime.exec: Too many open files
항목에서 단 1개의 메시지 - 트리로 보기
보낸 사람: Michael - 프로필 보기
날짜: 2000년5월26일(금) 오전12시00분
이메일: "Michael" <mforkh...@cell-loc.com>
그룹스: comp.lang.java.programmer
분류되지 않음
순위:
 
옵션 보기

Hello,

I have a remote object (Admin) bound to a CORBA Naming Service that offers
methods to start and stop my remote Java application (TestImpl) on its local
machine (running Solaris). My local application does a lookup on the Admin
object's interface and makes the suitable method calls to start and stop
TestImpl. This works great until I have restarted TestImpl about 40 times.
Then on the exec() call I get the following exception:

java.io.IOException: Too many open files
 at java.lang.UNIXProcess.forkAndExec(Native Method)
 at java.lang.UNIXProcess.forkAndExec(Compiled Code)
 at java.lang.UNIXProcess.<init>(Compiled Code)
 at java.lang.Runtime.execInternal(Native Method)
 at java.lang.Runtime.execInternal(Compiled Code)
 at java.lang.Runtime.exec(Compiled Code)
 at java.lang.Runtime.exec(Compiled Code)

Apparently the cause is not within my TestImpl code because I was able to
reproduce the problem even when I changed TestImpl into an empty application
(does nothing). So the problem would appear to be related to the exec()
call.

Here is how I start the process:
    ...
    Process process = Runtime.getRuntime().exec(myCmdLine);
    ....

Here is how I stop the process:
    ...
    (shutdown the program via remote shutdown call - causes an exit(0) )
    ...
    try
    {
        process.waitFor();
    }
    catch (Exception ee)
    {
        showError();
    }

    process.destroy();
    process = null;

THANKS a lot in advance for any and all suggestions of what might be wrong.

--
Michael


 

:
Posted by mastar