OCAPI Hook Circuit Breaker 20.10

The Hook Circuit Breaker feature improves stability and saves processing time by protecting the system from high rates of hook failures. It tracks calls to each hook type individually.

How It Works

Each extension point type has its own circuit breaker instance that tracks the rate of failed executions for that hook. The circuit breaker can be in one of three states: closed, open, or half-open. Normally, it’s closed. If at any time, the 100 most recent calls to the hook include more than 50 failures, the following process is triggered:

  1. The circuit breaker’s status changes to open. This change is logged.
  2. For 60 seconds, any calls to the failing extension point return an HTTP Status Code 503 (Service Unavailable) with the fault type HookCircuitBreakerException.
  3. After 60 seconds, the circuit breaker’s status changes to half-open. This change is logged.
  4. The circuit breaker tracks the next 10 calls to the failing extension point. If more than 5 of them fail, return to step 1.
  5. The circuit breaker’s status changes to closed and it resumes tracking calls to the hook. This change is logged.

Troubleshooting Hook Failures

If your hook calls return 503 (Service Unavailable) errors, use Log Center to investigate the cause.

  1. In Business Manager, navigate to Administration > Site Development > Development Setup.
  2. In the Log Files section, click Log Center.
  3. Select the Day of Year.
  4. In the LCQL field, enter HookCircuitBreaker.
  5. In the query hits, look for a HookInvocationException entry and click its Stack Trace UUID link.
  6. In the stack trace, find the Caused by section. It can contain information about the cause of the hook failures. Some possible causes include:
    • The hook contains a remote call that never returns a response, causing the hook to time out. In this case, try making an asynchronous OCAPI call instead.
    • The hook script contains errors. Fix the code and consider adding error handling measures.

For information on extension points and supported resources, see the Hooks topic.

X OCAPI obsolete versions 13.x and 14.x will be end of life in 2020 and versions 15.x and 16.x in 2021. For dates and more information, see the OCAPI versioning and deprecation policy and this Knowledge Article.
X Privacy Update: We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used. By continuing to use this site you are giving us your consent to do this. Privacy Policy.