Search code examples
spring-restspring-cloud-netflixhystrix

What happens when Hystrix walks away cause of a timeout, and server responds with any result?


For example, I enable Hystrix on my service, client, consuming another service, server. I set the Hystrix timeout to 5 seconds. After 5 seconds, if the server doesn't responds, the Hystrix will timeout and call fallback. What happens if the server responds after Hystrix is timed-out and walked-away from that call?

https://github.com/Netflix/Hystrix/wiki/How-it-Works#isolation


Solution

  • Once the Hystrix timeout triggers, Hystrix will send a Thread.interrupt() to the client side of the call. Depending on what you implemented in the Hystrix command, this might or might not have the effect on the client side of the call to abort. This can be configured with the execution.isolation.thread.interruptOnTimeout.

    The server part will usually continue to run. If your client side of the call wasn't aborted, it will receive the result. But the result will not be delivered to the caller of the Hystrix command. It will be discarded.