Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timeout does not cause exception / error escalation #129

Closed
c0dw opened this Issue Feb 19, 2019 · 0 comments

Comments

Projects
None yet
2 participants
@c0dw
Copy link

commented Feb 19, 2019

The timeout implemented in RunCommand.java does not trigger a proper error escalation. I still don't get an exitcode after a timeout in the onvoking process. My java skills are slightly rusty - so correct me if I'm wrong, but from your code (lines 203-209) I understand you're using java.util.concurrent.ExecutorService.shutdown() which causes an orderly shutdown and after that in line 209 you return 'returnCode[0]' which I suppose is initialized to literally zero as well. Therefore an invoking process does not get notified, that an irregular termination (due to a timeout) occurred, which makes error handling cumbersome. IMHO a timeout should push an error/exception up the call-stack.

...and here's a suggestion, how this issue might get resolved. Take it with a grain of salt, as I'm not a Java expert though...
I think the solution is using the return Value of the awaitTermination Method to determine the returnValue of your own function, like ...

if (!executorService.awaitTermination(timeoutInMinutes, TimeUnit.MINUTES)) {
        returnCode[0] = 1; // or whatever exitcode you might assign a timeout - except zero!
}

According to the API doc awaitTermination() returns true if this executor terminated and false if the timeout elapsed before termination.

@pesse pesse self-assigned this Feb 19, 2019

@pesse pesse added the bug label Feb 19, 2019

@pesse pesse added this to the 3.1.3 milestone Feb 19, 2019

@pesse pesse closed this in 079e021 Mar 14, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.