Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSL connection in async execution #832

Open
kaiserbergin opened this issue May 1, 2024 · 0 comments
Open

SSL connection in async execution #832

kaiserbergin opened this issue May 1, 2024 · 0 comments
Labels

Comments

@kaiserbergin
Copy link

Description

When executing multiple client calls via Task.WhenAll with the message The SSL connection could not be established, see inner exception., but the inner exception is null. Retry policies are a workaround at this point, but I'd like to understand the issue better, and understand what the inner exception should / could be.

Error Message: The SSL connection could not be established, see inner exception.
Inner Exception: null
Stack Trace:

   at Recurly.BaseClient.HandleResponse(IRestResponse resp)
   at Recurly.BaseClient.<>c__DisplayClass18_0`1.<MakeRequestAsync>b__0(Task`1 t)
   at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
   at Recurly.BaseClient.MakeRequestAsync[T](Method method, String url, Request body, Dictionary`2 queryParams, RequestOptions options, CancellationToken cancellationToken)

To Reproduce

Roughly what I'm doing, sans the resiliency policies, exception handling, and application logic:

var client = new Client(apiKey);
var @params = new ListInvoiceCouponRedemptionsParams
        {
            Sort = TimestampSort.UpdatedAt,
            BeginTime =  DateTimeOffset.Now.AddDays(-1),
            EndTime =  DateTimeOffset.Now,
        };

// Doing fifty invoice id's at a time from a larger batch
foreach (var taskChunk in idChunk.Chunk(50))
{
    var tasks = taskChunk.Select(async id =>
    {
        // Tried with newing up client or reusing, same issue applies...
        Pager<CouponRedemption> pager = client.ListInvoiceCouponRedemptions(id, @params);
        
        while (pager.HasMore)
        {
           // error happens here
           await pager.FetchNextPageAsync(cancellationToken).ConfigureAwait(false);
        }    
    });
    
    await Task.WhenAll(tasks);
}

Expected behavior

  • Inner exception should not be null if specified in exception.
  • If this is a my fault thing, I should change my code to look like... XXXX...
  • If this is unexpected for the client, it should establish the SSL connection

Your Environment

  • Library version: 4.51.0
  • .NET version: 7.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant