PlayFab/consuldotnet

Health.Service sometimes hangs

Opened this issue · 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.

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.