Skip to content

possible tight infinite loop of central config requests #3029

Closed

Description

elastic/apm-nodejs-http-client#185 was recently implemented for #2941
Ironically it made things worse.

Typically APM server's endpoint for central config will return a cache-control header, e.g.:

Cache-Control: max-age=<number of seconds>

If so, everything with v3.40.0 of the APM agent is fine.

However, if a central config request gets a response that doesn't specify a Cache-Control header, or one without a 'max-age' field, then getMaxAge(res) returns NaN and getCentralConfigIntervalS(NaN) unintentionally returns NaN:

> const INTERVAL_MIN_S = 5
undefined
> const INTERVAL_MAX_S = 86400 // 1d
undefined
> seconds = NaN
NaN
> Math.min(Math.max(seconds, INTERVAL_MIN_S), INTERVAL_MAX_S)
NaN

which leads to a tight loop of the agent hammering APM server for central config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

agent-nodejsMake available for APM Agents project planning.bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions