Github user miguno commented on the pull request:

    https://github.com/apache/storm/pull/456#issuecomment-77159580
  
    Many thanks for the PR, Kai!
    
    > However if the topology is submitted with `storm shell`, this cannot 
track exception because spawnvp seems to return no stdout and stderr.
    
    See [my 
comment](https://issues.apache.org/jira/browse/STORM-695?focusedCommentId=14340333&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14340333)
 in the STORM-695 JIRA ticket.  `os.spawnvp` returns the exit code of the 
process:
    
    ```python
    # return code can be 0 or non-zero, i.e. there will be no exception thrown 
like for sub.check_output
    return_code = os.spawnvp(os.P_WAIT, JAVA_CMD, all_args)
    ```
    
    However the problem is that Storm is currently not returning any non-zero 
return codes, even in the face of errors.  I haven't had the chance to 
test-drive your code yet, but the code in the PR might not work for the same 
reason:
    
    ```python
     try:
        ret = sub.check_output(all_args, stderr=sub.STDOUT)
        print(ret)
      except sub.CalledProcessError as e:
    ```
    
    If I understand the Python docs correctly, the `CalledProcessError` will 
only be thrown if the process returns with a non-zero exit code, and with 
current Storm this won't happen -- the return code will always be zero I think.
    
    One workaround could be to slightly adjust the code in the PR to simply 
grep for error messages in `STDOUT` / `STDERR` --  regardless of what the 
return code of the process is -- and, if there is a match, consider the 
process/command failed.
    
    (And please correct me if I'm wrong.)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to