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

Quality of Service - Configuration #908

Closed
ankitvijay opened this issue May 31, 2019 · 2 comments · Fixed by #1279
Closed

Quality of Service - Configuration #908

ankitvijay opened this issue May 31, 2019 · 2 comments · Fixed by #1279
Assignees
Labels
bug Identified as a potential bug merged Issue has been merged to dev and is waiting for the next release

Comments

@ankitvijay
Copy link
Contributor

Background

  • As per the Quality of Service, documentation we can set up TimeoutValue in isolation of the ExceptionsAllowedBeforeBreaking and DurationOfBreak options. I'm trying to only use TimeoutValue property without the other two.

Expected Behavior

  • Expected Behavior is that if I have just configure TimeoutValue then I should be able to call the API Gateway without any issue.

Actual Behavior

  • Configuring just the TimeoutValue returns 500 Internal Server Error. Here are logs:
[WRN] requestId: 80000010-0007-ff00-b63f-84710c7967bb, previousRequestId: no previous request id, message: Error making http request, exception: System.ArgumentException: The enumerable of policies to form the wrap must contain at least two policies.
Parameter name: policies
   at Polly.Policy.WrapAsync(IAsyncPolicy[] policies) in C:\projects\polly\src\Polly.Shared\Wrap\PolicyWrapSyntaxAsync.cs:line 93
   at Ocelot.Provider.Polly.PollyCircuitBreakingDelegatingHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
   at Ocelot.Requester.HttpClientHttpRequester.GetResponse(DownstreamContext context)

[WRN] requestId: 80000010-0007-ff00-b63f-84710c7967bb, previousRequestId: no previous request id, message: Error Code: UnableToCompleteRequestError Message: Error making http request, exception: System.ArgumentException: The enumerable of policies to form the wrap must contain at least two policies.
Parameter name: policies
   at Polly.Policy.WrapAsync(IAsyncPolicy[] policies) in C:\projects\polly\src\Polly.Shared\Wrap\PolicyWrapSyntaxAsync.cs:line 93
   at Ocelot.Provider.Polly.PollyCircuitBreakingDelegatingHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
   at Ocelot.Requester.HttpClientHttpRequester.GetResponse(DownstreamContext context) errors found in ResponderMiddleware. Setting error response for request path:/api/HomeAssessment/Codification/slowService/20, request method: GET
2019-05-31 11:54:27.395 +10:00 [ERR] <End Request> GET /api/HomeAssessment/Codification/slowService/20 500 8ms

Additional Information

This issue can be also be reproduced with Ocelot.AcceptanceTests -> PollyQoSTests. If we remove property ExceptionsAllowedBeforeBreaking from should_timeout and should_not_timeout methods, we get InternalServerError. As per documentation, this should not be case.

@kvskranthikumar
Copy link

Any solution?
I am also facing the same issue.

@midco-tylerjo
Copy link

Same issue for me. Appear to be getting the same error even with all 3 options provided. Would like to be able to only set TimeoutValue.

"QoSOptions": {
"ExceptionsAllowedBeforeBreaking":3,
"DurationOfBreak":1000,
"TimeoutValue":5000
}

DanHarltey added a commit to DanHarltey/Ocelot that referenced this issue Jul 1, 2020
@raman-m raman-m added bug Identified as a potential bug needs validation Issue has not been replicated or verified yet labels May 20, 2023
@raman-m raman-m linked a pull request May 20, 2023 that will close this issue
raman-m pushed a commit to DanHarltey/Ocelot that referenced this issue May 20, 2023
@raman-m raman-m added small effort Likely less than a day of development effort. accepted Bug or feature would be accepted as a PR or is being worked on and removed needs validation Issue has not been replicated or verified yet labels May 24, 2023
raman-m pushed a commit to DanHarltey/Ocelot that referenced this issue Aug 2, 2023
raman-m added a commit that referenced this issue Sep 22, 2023
* Fixing an issue where only setting timeout value in QoS would result in a exception getting thrown. Issue #908

* Apply wrapping in case of two policies or more

* Enable unit testing using DI pattern

* Add unit tests for the PollyCircuitBreakingDelegatingHandler class

* Split using sections for Ocelot.* and System.* namespaces

* Fix code review issue: "more than 1"

* File-scoped namespace

* Fix messages

* IDE1006 Naming rule violation: These words must begin with upper case characters

* IDE0062 Local function can be made static

* IDE1006 Naming rule violation: These words must begin with upper case characters: should_*

* Remove and Sort Usings

* Remove and Sort Usings

* RaynaldM code review

---------

Co-authored-by: Raman Maksimchuk <[email protected]>
@raman-m raman-m added merged Issue has been merged to dev and is waiting for the next release and removed accepted Bug or feature would be accepted as a PR or is being worked on small effort Likely less than a day of development effort. labels Sep 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Identified as a potential bug merged Issue has been merged to dev and is waiting for the next release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants