Skip to content

Connection state is not changed to Open from Connecting #21

Description

@sharok

Hello. I see a lot of exceptions in my log files and they are pretty the same:

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 PureWebSockets.PureWebSocket.<StartSender>b__59_0()

Why does it happen?

But, it's not a big problem. Recconection strategy usually handles it. BUT, not always, the library is stuck in Connecting state:

2019-07-12 08:03:48.762 -04:00 [ERR] Stocks WS error
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 PureWebSockets.PureWebSocket.<StartSender>b__59_0()
2019-07-12 08:03:48.763 -04:00 [INF] Stocks state: Aborted => Connecting
2019-07-12 08:03:48.966 -04:00 [INF] Stocks state: Connecting => Open
2019-07-12 09:30:10.254 -04:00 [ERR] 
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 PureWebSockets.PureWebSocket.<StartSender>b__59_0()
2019-07-12 09:30:10.254 -04:00 [ERR] Stocks WS error
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 PureWebSockets.PureWebSocket.<StartSender>b__59_0()
2019-07-12 09:30:10.255 -04:00 [INF] Stocks state: Aborted => Connecting

As you can see in the logs above, there was error and the library reconnected Aborted => Connecting => Open, but sometimes the library just change state to Connecting and that's it. There is no any messages/errors after that.

PS. I use standard reconection strategy:
new ReconnectStrategy(2000, 4000)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions