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

Hook execution sequence issue #328

Closed
krutsko opened this issue Oct 20, 2014 · 5 comments
Closed

Hook execution sequence issue #328

krutsko opened this issue Oct 20, 2014 · 5 comments
Labels
Milestone

Comments

@krutsko
Copy link

krutsko commented Oct 20, 2014

  1. Expected onComplete to be executed in all cases at the very end.
  2. in testExecutionHookRunFailureWithFallback - onComplete executed twice.

PR to demo that #327

Hook lifecycle captured during run of tests coming with Hystrix Core (version 1.3.9):
{noformat}
testExecutionHookSuccessfulCommand (execute):
onStart - onThreadStart - onRunStart - onRunSuccess - onComplete - onThreadComplete -

testExecutionHookSuccessfulCommand (queue)
onStart - onThreadStart - onRunStart - onRunSuccess - onComplete - onThreadComplete -

testExecutionHookSuccessfulCommandViaFireAndForget
onStart - onThreadStart - onRunStart - onRunSuccess - onComplete - onThreadComplete -

testExecutionHookSuccessfulCommandWithMultipleGetsOnFuture
onStart - onThreadStart - onRunStart - onRunSuccess - onComplete - onThreadComplete -

testExecutionHookRunFailureWithoutFallback
onStart - onThreadStart - onRunStart - *** simulated failed execution *** - onRunError - onFallbackStart - onFallbackError - onError - onThreadComplete -

testExecutionHookRunFailureWithFallback
onStart - onThreadStart - onRunStart - *** simulated failed execution *** - onRunError - onFallbackStart - onFallbackSuccess - onComplete - onComplete - onThreadComplete -

testExecutionHookRunFailureWithFallbackFailure
onStart - onThreadStart - onRunStart - *** simulated failed execution *** - onRunError - onFallbackStart - onFallbackError - onError - onThreadComplete -

testExecutionHookTimeoutWithoutFallback
onStart - onThreadStart - onRunStart - ***** running - onFallbackStart - onFallbackError - onError - after interruption with extra sleep
onRunSuccess - onThreadComplete -

testExecutionHookTimeoutWithFallback
onStart - onThreadStart - onRunStart - ***** running - onFallbackStart - onFallbackSuccess - onComplete - after interruption with extra sleep - onRunSuccess - onThreadComplete -

testExecutionHookRejectedWithFallback
onStart - onFallbackStart - onFallbackSuccess - onComplete

testExecutionHookShortCircuitedWithFallbackViaQueue
onStart - onFallbackStart - onFallbackError - onError -

testExecutionHookShortCircuitedWithFallbackViaExecute
onStart - onFallbackStart - onFallbackError - onError -

testExecutionHookSuccessfulCommandWithSemaphoreIsolation
onStart - onRunStart - onRunSuccess - onComplete -

testExecutionHookFailureWithSemaphoreIsolation
onStart - onFallbackStart - onFallbackError - onError -

testExecutionHookFailedOnHystrixBadRequestWithSemaphoreIsolation:
onStart - onRunStart - *** simulated failed execution ***onRunError -
{noformat}

@benjchristensen
Copy link
Contributor

  1. Expected onComplete to be executed in all cases at the very end.

onComplete is the successful termination event. onError is the failure termination event.

As per the Javadoc:

onComplete: Invoked after completion of {@link HystrixCommand} execution that results in a response.
onError: Invoked after failed completion of {@link HystrixCommand} execution.
  1. in testExecutionHookRunFailureWithFallback - onComplete executed twice.

Will need to look into that.

@benjchristensen benjchristensen added this to the 1.4 milestone Oct 27, 2014
@pparth
Copy link

pparth commented Oct 27, 2014

@benjchristensen can you explain please why onComplete is raised before onThreadComplete, whereas onThreadStart is raised after onStart?

@benjchristensen
Copy link
Contributor

Because onThreadComplete happens AFTER (try/finally) it has returned the value back to the main thread which returns to the user and completes thus calling onComplete. onThreadStart happens AFTER the command has started.

@krutsko
Copy link
Author

krutsko commented Oct 27, 2014

@benjchristensen please also take a look at
testExecutionHookFailedOnHystrixBadRequestWithSemaphoreIsolation
Expected : onStart - onRunStart - onRunError - onError -
Actual :onStart - onRunStart - onRunError -

@mattrjacobs mattrjacobs removed this from the 1.4 milestone Dec 19, 2014
@krutsko krutsko removed this from the 1.4 milestone Dec 19, 2014
@mattrjacobs mattrjacobs added this to the 1.4.0-RC6 milestone Dec 19, 2014
@mattrjacobs
Copy link
Contributor

I think this is now resolved via #378 and a new issue opened around onThreadComplete work in #377

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants