Cancelling a job which spawns multiple processes that are not necessarily child processes

已答复 Cancelling a job which spawns multiple processes that are not necessarily child processes

  • 2009年11月30日 18:13
     
     
    Hi,

    I am submitting a job to execute a ".bat" file. From the bat file I spawn a java process, which further spawns some processes via JNI and COM API calls. So as a result of this, the following processes are created:

    1) cmd.exe
    2) java.exe
    3) other processes as a result of JNI/COM API calles

    Now when I cancel the job, the cmd.exe and java.exe processes get killed, but the processes that were spawned as a result of JNI calls keep hanging in there indefinitely. Is there any way of handling this problem in the Windows cluster? Is there a way to tell the cluster manager to cancel a job and kill all the processes related to the process, even if they are not child processes? What is the mechanism used on the cluster nodes to cancel a job?

    Thanks,
    Prashant

全部回复

  • 2009年12月3日 19:24
    版主
     
     

    Hi Prashant,

    Once a task gets canceled, the Windows Job spawned by the task will be stopped. All processes within this Windows Job will be killed. A process’s sub-processes always belongs to the same Windows Job (unless otherwise specified when creating the sub-process), hence will be killed as well. That’s why you saw the cmd and java were killed. However, the JNI and COM program were started by another service. So they were running out of the current Windows Job. In this case, they won’t be killed.
    COM runs as a separate service and it is spawning up these extra processes. It is up-to the server to clean these up after the user process exits.

    Thanks,
    Rae

     

  • 2009年12月3日 21:08
     
     
    Thanks for the response Rae!

    Is there any option to tell the cluster manager, that instead of killing a job forcefully, call another program (which a user specifies) which manages clean exit of a task?

    Regards,
    Prashant
  • 2009年12月4日 19:04
    版主
     
     已答复

    This customization feature will be in V3, but not V2.