Skip to content

Node.js EurekaClient: retry loop has no circuit breaker or inter-cycle backoff #4775

Description

@balhar-jakub

Description

The Node.js onboarding enabler EurekaClient has no circuit breaker for its retry logic. When Eureka is unreachable, the client enters an unbounded retry loop with no backoff between interval cycles.

Retry mechanism

Per-request retries use a linear delay (EurekaClient.js:703-704):

const nextRetryDelay = this.config.eureka.requestRetryDelay * (retryAttempt + 1);
// = 500ms, 1000ms, 1500ms → burst exhausts in ~3s

With defaults (defaultConfig.js:56-59):

heartbeatInterval: 30000,
registryFetchInterval: 30000,
maxRetries: 3,
requestRetryDelay: 500,

Interval timers never stop

Heartbeats and registry fetches use setInterval that fires every 30s forever (EurekaClient.js:313-316, 347-352):

startHeartbeats() {
    this.heartbeat = setInterval(() => this.renew(), 30000);
}
startRegistryFetches() {
    this.registryFetch = setInterval(() => this.fetchRegistry(...), 30000);
}

clearInterval is only called in stop(). There is no pause or backoff on failure.

Resulting failure pattern

Each 30s tick spawns a fresh request with its own independent 3-retry burse, producing this pattern indefinitely:

t=0:   heartbeat burst (4 attempts, ~3s) — all fail
t=0:   registry burst (4 attempts, ~3s) — all fail
t=30:  heartbeat burst again
t=30:  registry burst again
...repeats forever

What is missing

  • No consecutive failure counter that spans interval cycles
  • No exponential backoff between cycles (30s interval is fixed)
  • No circuit breaker state (closed → open → half-open)
  • No pause/suspend mechanism when Eureka is persistently unreachable

Expected behavior

After N consecutive interval-cycle failures, the client should either:

  • Increase the interval between cycles (exponential backoff), or
  • Enter a circuit-open state where it stops attempting until a cool-down period elapses

Files

  • onboarding-enabler-nodejs/src/EurekaClient.js:313-316 (startHeartbeats)
  • onboarding-enabler-nodejs/src/EurekaClient.js:347-352 (startRegistryFetches)
  • onboarding-enabler-nodejs/src/EurekaClient.js:698-710 (retry logic)
  • onboarding-enabler-nodejs/src/defaultConfig.js:56-59 (defaults)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status
    Planned In Future

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions