[ 
https://issues.apache.org/jira/browse/HADOOP-11989?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14551122#comment-14551122
 ] 

Chackaravarthy commented on HADOOP-11989:
-----------------------------------------

Tried adding test case but it fails with,
{quote}
ExitCodeException exitCode=1: kill: illegal process id: --
{quote} 

Added a test case by getting the current process id and doing "kill -0 -- 
<proc_id>" to check command execute properly with out any any ExitCodeException 
(since its an running process).

But the same command works in shell, but not through test case. (my working 
environment is OS/X)

{code}
       public void testCheckProcessAliveCommand() throws Exception {
                String processName = 
ManagementFactory.getRuntimeMXBean().getName();
                long processId = Long.parseLong(processName.split("@")[0]);
                String[] isAliveCommand = 
Shell.getCheckProcessIsAliveCommand(String
                                .valueOf(processId));
                System.out.println(Arrays.toString(isAliveCommand));
                Shell.ShellCommandExecutor shexec = new 
Shell.ShellCommandExecutor(
                                isAliveCommand);
                try {
                        shexec.execute();
                } catch (Exception e) {
                        e.printStackTrace();
                        fail("command should not throw exception : " + 
e.getMessage());
                }
        }
{code}

Can anyone please help me out here? Thanks.

> Kill command for process group id throws ExitCodeException
> ----------------------------------------------------------
>
>                 Key: HADOOP-11989
>                 URL: https://issues.apache.org/jira/browse/HADOOP-11989
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: util
>    Affects Versions: 2.6.0
>         Environment: debian 7
>            Reporter: Chackaravarthy
>            Assignee: Chackaravarthy
>         Attachments: HADOOP-11989.patch
>
>
> In the environment where setsid available, kill command is constructed with 
> single dash, which throws ExitCodeException (improper usage of command) 
> {noformat}
> kill -signal_num -<process_group_id>
> {noformat}
> Encountered this issue due to YARN-3561 
> Kill command need to be constructed with double dash (--) which means "end of 
> command options" i.e. it tells ssh command not to try to parse what comes 
> after command line options. It should be constructed as follows :
> {noformat}
> kill -signal_num -- -<process_group_id>
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to