June 8, 2013

Wresting with java on running processes

Take away of a couple of hours of wrestling with java: Java is stupid in taking care of running external processes and loses track. I executed around two million system processes, to get there on big data processing.

(pool-5-thread-5) java.lang.OutOfMemoryError: unable to create new native thread   

Also generated error was: not enough resources to run the next processes.

The fix:
After each blocking Runtime.exec("command") call Process.destroy.

----
Process process = Runtime.getRuntime().exec(commandWget);
                       
process.destroy();
--

PS-

No comments:

Post a Comment