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

Circuit Breaker or Timeout Configuration Not Working as Expected in Ocelot #2237

Closed
aftabkajal opened this issue Dec 13, 2024 · 3 comments
Closed
Labels
QoS Ocelot feature: Quality of Service aka Polly

Comments

@aftabkajal
Copy link

I am using Ocelot as my API Gateway and have configured QoS options to include a circuit breaker and timeout for downstream requests. However, the behavior is not working as expected. Specifically:

Timeout Behavior:

When the TimeoutValue is set (e.g., 3000ms), requests taking longer than the specified duration do not always return a timeout error. Instead, the requests continue and eventually return the downstream response.

Circuit Breaker Behavior:

While testing the ExceptionsAllowedBeforeBreaking functionality, I noticed that the circuit breaker does not transition to the "Open" state after the specified number of exceptions.

Despite setting ExceptionsAllowedBeforeBreaking to a value (e.g., 3), the circuit breaker does not seem to open even when more exceptions than the allowed threshold are encountered consecutively.

Reproduction Steps:

  • Set up Ocelot with the above configuration.
  • Simulate a downstream service delay greater than TimeoutValue (e.g., 4000ms).
  • Trigger exceptions by returning HTTP 500 responses from the downstream service for at least 3 consecutive requests. Observe Ocelot's behavior with regards to timeouts and the circuit breaker state.

image

Configuration used in global configuration and route level:
"QoSOptions": {
"TimeoutValue": 3000,
"DurationOfBreak": 2000,
"ExceptionsAllowedBeforeBreaking": 3
}

Specifications

  • Version: 23.4.2
  • Platform: Docker
  • Subsystem: Linux
@aftabkajal
Copy link
Author

This issue has been resolved my-self.

@raman-m
Copy link
Member

raman-m commented Dec 13, 2024

Hello, Md. Aftab!
🆗 What was wrong?

Timeout Behavior:
When the TimeoutValue is set (e.g., 3000ms), requests taking longer than the specified duration do not always return a timeout error. Instead, the requests continue and eventually return the downstream response.

What is the frequency with which you have encountered this? What proportion of the total number of requests does it represent?

P.S.

Please aware that the label: Core Timeout logic may be quite unstable, and sometimes a timeout event can be triggered of the specified period. We are going to refactor the Timeout logic by migrating to the .NET SocketsHttpHandler class →

@raman-m raman-m added the QoS Ocelot feature: Quality of Service aka Polly label Dec 13, 2024
@aftabkajal aftabkajal reopened this Dec 15, 2024
@aftabkajal
Copy link
Author

Hello @raman-m ,

I am currently facing an issue (#2241) and would greatly appreciate your assistance in resolving it. This is quite urgent for me, and your guidance would be incredibly helpful.

Looking forward to your response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
QoS Ocelot feature: Quality of Service aka Polly
Projects
None yet
Development

No branches or pull requests

2 participants