consuldotnet icon indicating copy to clipboard operation
consuldotnet copied to clipboard

Health.Service sometimes hangs

Open rogeralsing opened this issue 6 years ago • 1 comments

I have the following line:

var statuses = await _client.Health.Service(_clusterName, null, true, CancellationToken.None);

This is polled in a loop in x seconds. once in a while, this gets completely stuck, never returning. Even when providing a cancellation token with a cancel timer, this is still the case.

(Same behavior if I use the "blocking query" support where I pass the previous index to the call too)

The never returning part, is that a Consul or Consul.NET bug? The fact that it ignores the cancellation token makes me think this is a Consul.NET issue.

rogeralsing avatar Oct 15 '17 17:10 rogeralsing

It probably is a tasks issue, given what I've seen of "hangs" from this. How thread or task heavy is your application? Could you be using up all threads available in the threadpool for tasks? The code here is super simple - all it's doing at a task level is making a task-based async HTTP request to an endpoint, there's nothing fancy in this method. I agree that it's a "Consul.NET" issue but I don't think it's the code explicitly from Consul.NET - rather, I think there's never a thread available for the task to return on.

highlyunavailable avatar Oct 15 '17 18:10 highlyunavailable