You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@storm.apache.org by reembs <gi...@git.apache.org> on 2015/03/29 17:23:48 UTC

[GitHub] storm pull request: Fixed two bugs preventing ShellBolts from gett...

GitHub user reembs opened a pull request:

    https://github.com/apache/storm/pull/489

    Fixed two bugs preventing ShellBolts from getting killed if they don't heartbeat properly

    https://issues.apache.org/jira/browse/STORM-733
    https://issues.apache.org/jira/browse/STORM-734

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/forter/storm shell-bolts-heartbeat-death-bugs

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/storm/pull/489.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #489
    
----
commit 530c0458ed04e06b8037ed286d521345bd78eecd
Author: Re'em Bensimhon <re...@forter.com>
Date:   2015-03-29T14:55:41Z

    [STORM-733] ShellBolts that don't respond to heartbeats are not being killed
    [STORM-734] When ShellBolt dies it calls System.exit, which doesn't always shut the process down

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm pull request: [STORM-733] ShellBolts that don't respond to h...

Posted by HeartSaVioR <gi...@git.apache.org>.
Github user HeartSaVioR commented on the pull request:

    https://github.com/apache/storm/pull/489#issuecomment-173799264
  
    @reembs Would you like me to follow up this PR, or would you close it?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm pull request: [STORM-733] ShellBolts that don't respond to h...

Posted by HeartSaVioR <gi...@git.apache.org>.
Github user HeartSaVioR commented on the pull request:

    https://github.com/apache/storm/pull/489#issuecomment-173798895
  
    Seems like issue is not valid cause we replace IOUtils.toString(processErrorStream) with processErrorStream.available().
    Maybe it was handled from another pull request.
    
    Then for me this PR just refactors duplicate codes.
    I think it is still fine, but not mandatory. And it should be treated to other issue since this issue is no longer valid.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm pull request: [STORM-733] [STORM-734] Fixed two bugs prevent...

Posted by itaifrenkel <gi...@git.apache.org>.
Github user itaifrenkel commented on a diff in the pull request:

    https://github.com/apache/storm/pull/489#discussion_r27454715
  
    --- Diff: storm-core/src/jvm/backtype/storm/utils/ShellProcess.java ---
    @@ -121,34 +117,15 @@ public void writeTaskIds(List<Integer> taskIds) throws IOException {
         }
     
         public void logErrorStream() {
    -        try {
    -            while (processErrorStream.available() > 0) {
    -                int bufferSize = processErrorStream.available();
    -                byte[] errorReadingBuffer = new byte[bufferSize];
    -                processErrorStream.read(errorReadingBuffer, 0, bufferSize);
    -                ShellLogger.info(new String(errorReadingBuffer));
    -            }
    -        } catch (Exception e) {
    +        final Optional<String> errorsString = getErrorStreamMessage();
    +        if (errorsString.isPresent()) {
    +            ShellLogger.info(errorsString.get());
             }
         }
     
         public String getErrorsString() {
    --- End diff --
    
    add a comment saying this method must never block since it is run during critical shutdown phase


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm pull request: [STORM-733] [STORM-734] Fixed two bugs prevent...

Posted by reembs <gi...@git.apache.org>.
Github user reembs commented on a diff in the pull request:

    https://github.com/apache/storm/pull/489#discussion_r27498856
  
    --- Diff: storm-core/src/jvm/backtype/storm/utils/ShellProcess.java ---
    @@ -186,4 +163,35 @@ public String getProcessInfoString() {
         public String getProcessTerminationInfoString() {
             return String.format(" exitCode:%s, errorString:%s ", getExitCode(), getErrorsString());
         }
    +
    +    private Optional<String> getErrorStreamMessage() {
    +        int offset = 0;
    +        if (processErrorStream != null) {
    +            ByteArrayOutputStream out = null;
    +            try {
    +                do {
    +                    int bufferSize = processErrorStream.available();
    +                    if (bufferSize > 0) {
    +                        if (out == null) {
    +                            out = new ByteArrayOutputStream();
    --- End diff --
    
    this method gets called a lot. didn't want to create needlessly.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm pull request: [STORM-733] ShellBolts that don't respond to h...

Posted by reembs <gi...@git.apache.org>.
Github user reembs commented on the pull request:

    https://github.com/apache/storm/pull/489#issuecomment-178667030
  
    @HeartSaVioR I see the original bug was already fixed. I like the PR code better, but that's esthetics. Not worth the hassle, Closing.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm pull request: [STORM-733] [STORM-734] Fixed two bugs prevent...

Posted by itaifrenkel <gi...@git.apache.org>.
Github user itaifrenkel commented on a diff in the pull request:

    https://github.com/apache/storm/pull/489#discussion_r27454586
  
    --- Diff: storm-core/src/jvm/backtype/storm/utils/ShellProcess.java ---
    @@ -18,21 +18,17 @@
     package backtype.storm.utils;
     
     import backtype.storm.Config;
    -import backtype.storm.multilang.ISerializer;
    -import backtype.storm.multilang.BoltMsg;
    -import backtype.storm.multilang.NoOutputException;
    -import backtype.storm.multilang.ShellMsg;
    -import backtype.storm.multilang.SpoutMsg;
    +import backtype.storm.multilang.*;
    --- End diff --
    
    don't change imports if you dont have to. Different devs are using different IDEs


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm pull request: [STORM-733] [STORM-734] Fixed two bugs prevent...

Posted by itaifrenkel <gi...@git.apache.org>.
Github user itaifrenkel commented on a diff in the pull request:

    https://github.com/apache/storm/pull/489#discussion_r27454334
  
    --- Diff: storm-core/src/jvm/backtype/storm/utils/ShellProcess.java ---
    @@ -186,4 +163,35 @@ public String getProcessInfoString() {
         public String getProcessTerminationInfoString() {
             return String.format(" exitCode:%s, errorString:%s ", getExitCode(), getErrorsString());
         }
    +
    +    private Optional<String> getErrorStreamMessage() {
    +        int offset = 0;
    +        if (processErrorStream != null) {
    +            ByteArrayOutputStream out = null;
    +            try {
    +                do {
    +                    int bufferSize = processErrorStream.available();
    +                    if (bufferSize > 0) {
    +                        if (out == null) {
    +                            out = new ByteArrayOutputStream();
    +                        }
    +                        byte[] errorReadingBuffer = new byte[bufferSize];
    +                        final int read = processErrorStream.read(errorReadingBuffer, 0, bufferSize);
    +                        out.write(errorReadingBuffer, offset, bufferSize);
    +                        offset += read;
    +                    }
    +                } while (processErrorStream.available() > 0);
    +
    +                if (offset > 0)
    +                    return of(new String(out.toByteArray()));
    +            } catch (Exception e) {
    +                return of("(Unable to capture error stream)");
    +            } finally {
    +                if (out != null) {
    +                    IOUtils.closeQuietly(out);
    +                }
    +            }
    +        }
    +        return Optional.absent();
    --- End diff --
    
    @reembs This project ussually do not use Optional<>... so I would just return an empty string


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm pull request: [STORM-733] [STORM-734] Fixed two bugs prevent...

Posted by itaifrenkel <gi...@git.apache.org>.
Github user itaifrenkel commented on a diff in the pull request:

    https://github.com/apache/storm/pull/489#discussion_r27454492
  
    --- Diff: storm-core/src/jvm/backtype/storm/utils/ShellProcess.java ---
    @@ -186,4 +163,35 @@ public String getProcessInfoString() {
         public String getProcessTerminationInfoString() {
             return String.format(" exitCode:%s, errorString:%s ", getExitCode(), getErrorsString());
         }
    +
    +    private Optional<String> getErrorStreamMessage() {
    +        int offset = 0;
    +        if (processErrorStream != null) {
    +            ByteArrayOutputStream out = null;
    +            try {
    +                do {
    +                    int bufferSize = processErrorStream.available();
    +                    if (bufferSize > 0) {
    +                        if (out == null) {
    +                            out = new ByteArrayOutputStream();
    +                        }
    +                        byte[] errorReadingBuffer = new byte[bufferSize];
    +                        final int read = processErrorStream.read(errorReadingBuffer, 0, bufferSize);
    +                        out.write(errorReadingBuffer, offset, bufferSize);
    +                        offset += read;
    +                    }
    +                } while (processErrorStream.available() > 0);
    +
    +                if (offset > 0)
    +                    return of(new String(out.toByteArray()));
    +            } catch (Exception e) {
    +                return of("(Unable to capture error stream)");
    --- End diff --
    
    e.getMessage()


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm pull request: [STORM-733] ShellBolts that don't respond to h...

Posted by reembs <gi...@git.apache.org>.
Github user reembs closed the pull request at:

    https://github.com/apache/storm/pull/489


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm pull request: [STORM-733] [STORM-734] Fixed two bugs prevent...

Posted by itaifrenkel <gi...@git.apache.org>.
Github user itaifrenkel commented on a diff in the pull request:

    https://github.com/apache/storm/pull/489#discussion_r27454560
  
    --- Diff: storm-core/src/jvm/backtype/storm/utils/ShellProcess.java ---
    @@ -186,4 +163,35 @@ public String getProcessInfoString() {
         public String getProcessTerminationInfoString() {
             return String.format(" exitCode:%s, errorString:%s ", getExitCode(), getErrorsString());
         }
    +
    +    private Optional<String> getErrorStreamMessage() {
    +        int offset = 0;
    +        if (processErrorStream != null) {
    +            ByteArrayOutputStream out = null;
    +            try {
    +                do {
    +                    int bufferSize = processErrorStream.available();
    +                    if (bufferSize > 0) {
    +                        if (out == null) {
    +                            out = new ByteArrayOutputStream();
    --- End diff --
    
    why lazy?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] storm pull request: [STORM-733] [STORM-734] Fixed two bugs prevent...

Posted by itaifrenkel <gi...@git.apache.org>.
Github user itaifrenkel commented on a diff in the pull request:

    https://github.com/apache/storm/pull/489#discussion_r27454533
  
    --- Diff: storm-core/src/jvm/backtype/storm/utils/ShellProcess.java ---
    @@ -186,4 +163,35 @@ public String getProcessInfoString() {
         public String getProcessTerminationInfoString() {
             return String.format(" exitCode:%s, errorString:%s ", getExitCode(), getErrorsString());
         }
    +
    +    private Optional<String> getErrorStreamMessage() {
    +        int offset = 0;
    +        if (processErrorStream != null) {
    +            ByteArrayOutputStream out = null;
    +            try {
    +                do {
    +                    int bufferSize = processErrorStream.available();
    +                    if (bufferSize > 0) {
    +                        if (out == null) {
    +                            out = new ByteArrayOutputStream();
    +                        }
    +                        byte[] errorReadingBuffer = new byte[bufferSize];
    +                        final int read = processErrorStream.read(errorReadingBuffer, 0, bufferSize);
    +                        out.write(errorReadingBuffer, offset, bufferSize);
    +                        offset += read;
    +                    }
    +                } while (processErrorStream.available() > 0);
    --- End diff --
    
    you can move this check inside so it would be more readable. if (bufferSize == 0) { break;}


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---