TwitchLib / TwitchLib.PubSub

PubSub component of TwitchLib.
38 stars 52 forks source link

Unclear error message #118

Open Shurron opened 1 year ago

Shurron commented 1 year ago

I'm using v3.2.6

_pubSub.OnPubSubServiceError += _pubSub_OnPubSubServiceError;

private void _pubSub_OnPubSubServiceError(object sender, TwitchLib.PubSub.Events.OnPubSubServiceErrorArgs e)
{
    Console.WriteLine($"PubSub: {e.Exception}");
}

Everything working fine for about 4 hours, but then I'm getting this error:

PubSub: System.OperationCanceledException: The operation was canceled. at System.Collections.Concurrent.BlockingCollection`1.TryTakeWithNoTimeValidation(T& item, Int32 millisecondsTimeout, CancellationToken cancellationToken, CancellationTokenSource combinedTokenSource) at System.Collections.Concurrent.BlockingCollection`1.TryTake(T& item, Int32 millisecondsTimeout, CancellationToken cancellationToken) at System.Collections.Concurrent.BlockingCollection`1.Take(CancellationToken cancellationToken) at TwitchLib.Communication.Services.Throttlers.b__28_0() PubSub: System.OperationCanceledException: The operation was canceled. at System.Collections.Concurrent.BlockingCollection`1.TryTakeWithNoTimeValidation(T& item, Int32 millisecondsTimeout, CancellationToken cancellationToken, CancellationTokenSource combinedTokenSource) at System.Collections.Concurrent.BlockingCollection`1.TryTake(T& item, Int32 millisecondsTimeout, CancellationToken cancellationToken) at System.Collections.Concurrent.BlockingCollection`1.Take(CancellationToken cancellationToken) at TwitchLib.Communication.Services.Throttlers.b__29_0()

My problem is access token expiring (I think so), but how can I be sure what's actually happenning from this error message? There should be some more user-friendly error message from Twitch describing what's going wrong. Could you please make a changes to provide us this error message?

Mahsaap commented 1 year ago

add onlog event and see if anything additional shows.

Shurron commented 1 year ago

With OnLog event output now looks like this:

[2023-05-05 17:44:42] [Debug] PubSub::OnLog: { "type": "RECONNECT" } [2023-05-05 17:44:42] [Error] PubSub: System.OperationCanceledException: The operation was canceled. at System.Collections.Concurrent.BlockingCollection`1.TryTakeWithNoTimeValidation(T& item, Int32 millisecondsTimeout, CancellationToken cancellationToken, CancellationTokenSource combinedTokenSource) at System.Collections.Concurrent.BlockingCollection`1.TryTake(T& item, Int32 millisecondsTimeout, CancellationToken cancellationToken) at System.Collections.Concurrent.BlockingCollection`1.Take(CancellationToken cancellationToken) at TwitchLib.Communication.Services.Throttlers.b__28_0() [2023-05-05 17:44:42] [Error] PubSub: System.OperationCanceledException: The operation was canceled. at System.Collections.Concurrent.BlockingCollection`1.TryTakeWithNoTimeValidation(T& item, Int32 millisecondsTimeout, CancellationToken cancellationToken, CancellationTokenSource combinedTokenSource) at System.Collections.Concurrent.BlockingCollection`1.TryTake(T& item, Int32 millisecondsTimeout, CancellationToken cancellationToken) at System.Collections.Concurrent.BlockingCollection`1.Take(CancellationToken cancellationToken) at TwitchLib.Communication.Services.Throttlers.b__29_0() [2023-05-05 17:44:59] [Debug] PubSub::OnLog: {"type":"RESPONSE","error":"","nonce":"CNCrhM41"}

Mahsaap commented 1 year ago

I'm keep seeing blocking, your not running this in a UI class by any chance? But it does look like reconnect is mentioned. So it could be the token. Have you verified it's working with API? Also showing the relevant code could help since I'm kinda guessing at this point.