11

I'm getting hundreds of these process_reaper threads that build up over time in my application. Anyone have any idea what these may be? They seem to be in my use of Runtime.exec() however I'm destroying my process in a finally statement but they still show up

screen shot: http://www.dropmocks.com/mBxM5

Process proc = null;
        String line;
        try {
            logger.info("Trying to execute command " + Arrays.asList(command).toString().replace(",", ""));
            proc = Runtime.getRuntime().exec(command);

        } catch (IOException e) {
            logger.info("IOException while trying to execute " + command);
            return false;
        } finally {
            if(proc != null) {
                proc.destroy();
            }
    }
James
  • 15,085
  • 25
  • 83
  • 120

2 Answers2

7

I haven't seen this one myself so I searched a little; it seems a process reaper is related to the Linux kernel process management and is a daemon thread. It maintains the process state so that resources can be freed/released/collected on process termination and so on. This resource might help you. There is a mention on reapers in the final parts.

Sagar V
  • 1,916
  • 15
  • 23
  • 1
    thanks for the link, reading now, any idea how to get rid of them? – James Oct 01 '10 at 03:09
  • From your screen-shot it seems they are being disposed off. Anyway they are required since you are spawning a separate process using Runtime.exec(). I'm not too sure how to get rid of them since I haven't seen them myself :-) – Sagar V Oct 01 '10 at 03:15
  • AH! thanks Sagar, that tipped me off, I closed and restarted visual VM and the threads were gone, so yes they are being cleaned up. thanks :) – James Oct 01 '10 at 03:39
0

you must call process.waitFor() after exec and before destory (asy action)