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

Async demo 09: Never stops after running 14+ requests #25

Closed
kabua opened this issue Apr 14, 2021 · 5 comments
Closed

Async demo 09: Never stops after running 14+ requests #25

kabua opened this issue Apr 14, 2021 · 5 comments
Assignees

Comments

@kabua
Copy link
Contributor

kabua commented Apr 14, 2021

After running the demo a few times and allowing it to run for several request, 14+ times), the screen fills up with

Object name: 'System.Net.Http.HttpClient'.

The exception happens on line 159.

@martincostello
Copy link
Member

Looks like when the loop ends by the CancellationToken being fired and the HttpClient is disposed of:

If there are any cancelled HTTP requests still pending to run, they'll try to use the now-disposed HttpClient, causing an ObjectDisposedException:

client.GetStringAsync(Configuration.WEB_API_ROOT + "/api/values/" + totalRequests),

@kabua
Copy link
Contributor Author

kabua commented Apr 14, 2021

Yes, that is correct.

However, the policy is configured to handle all exceptions and to run forever, and the policyWrap.ExecuteAsync() is accepting a cancellationToken but which appears not to be honoring.

Also, how would I write something like, handle all exceptions except for MyException? Something like:
Policy.Handle<Exception>().ButNot<MyException>()...

Thanks.

@martincostello
Copy link
Member

@peter-csala Something to consider when you get to migrating this demo.

@peter-csala
Copy link
Contributor

@martincostello Please assign to me, otherwise I will forget it :)

@peter-csala
Copy link
Contributor

After the V8 migration I can not reproduce the problem. The application can be stopped any time.

samples_issue_25

@martincostello I think we can close this issue if you agree.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants