Hystrix circuit not closing after downstream service recovers
<p>I'm playing with the <a href="http://github.com/joshlong/Bootiful-Microservices" rel="nofollow noreferrer">bootiful-microservice project</a> by Josh Long. (Brixton subproject)</p>

<p>On the reservation-service I have added a simple status method that can sleep a configurable amount of time to simulate load:</p>

<pre><code>@RequestMapping(method = RequestMethod.GET, value = "/status")
public String status(){
    System.out.println("Checking status");
    try {
        Thread.sleep((long) (rand.nextDouble()*sleepTime));
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    return "All is good";
}
</code></pre>

<p>The <code>sleepTime</code> variable is pulled from the Spring Config Server</p>

<p>On the reservation-client I have added an entry point in the gateway:</p>

<pre><code>@FeignClient("reservation-service")
interface ReservationReader {

    @RequestMapping(method = RequestMethod.GET, value = "/reservations")
    Resources&lt;Reservation&gt; readReservations();

    @RequestMapping(method = RequestMethod.GET, value = "/status")
        String status();
    }
}
</code></pre>

<p>and I'm using an <code>HystrixCommand</code></p>

<pre><code>@HystrixCommand(fallbackMethod = "statusFallback")
@RequestMapping(method = RequestMethod.GET, value = "/status")
public String status(){
    return reader.status();
}

public String statusFallback(){
    return "Bad";
}
</code></pre>

<p>This all works well.</p>

<p>I set the sleeping time to 1500ms so that some request will be above the Hystrix default threshold (1000ms).</p>

<p>When I start hitting the API I get some failures due to timeout. If I hit long enough (50 times seems to work) the circuit breaker trigger and the circuit becomes open:</p>

<p><a href="https://i.stack.imgur.com/nX2cd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nX2cd.png" alt="Hystrix Dashboard"></a></p>

<p>My understanding is that as the downstream service becomes healthy again Hystrix will try to route 1 call and use it as a health check. If the call is successful circuit should be closed again.</p>

<p>However this is not happening here. The circuit will remain open even after changing the sleeping time to a smaller value (let's say 500ms). None of my calls are routed towards the reservation-services and the fallback is used on every call. The only way I can get the circuit to close again is to restart the reservation-client service.</p>

<p>Did I miss something? Is it an issue with Hystrix? Or with the Spring Integration?</p>

<hr>

<p><strong>UPDATE</strong></p>

<p>I did further testing and I can confirm that the circuit will remain close forever, even after the sleeping has been reduced.</p>

<p>However if I use a route in the Zuul configuration I get the expected behaviour. The circuit closes itself if it sees a request that doesn't time out.</p>

<p>I have noticed another difference between forwarding by route compare to manually doing it in Spring. If I create a filter my /status/ call on the client does not trigger the filter. When I setup a route (eg. /foos/status => /status) it will trigger the filter and Hystrix behaves properly.</p>

<p>Is that a bug in Spring?</p>