Nomad is an easy-to-use, flexible, and performant workload orchestrator that can deploy a mix of microservice, batch, containerized, and non-containerized applications. Nomad is easy to operate and scale and has native Consul and Vault integrations.
We tested with Nomad v1.5.5, but we think this reproduces in tip.
Operating system and Environment details
Unix
Issue
Unsetting node metadata keys leave them as null on the client node until it restarts. This causes steady increase in memory, and there doesn’t seem to be another way of removing the keys otherwise.
Description
The Update Node Metadata HTTP API allows us to dynamically set key-value metadata. The documentation mentions that one can ‘unset’ keys by requesting updates with value=null.
After waiting 10s for the node data to be propagated to the scheduler, the response from Read Node Metadata HTTP API shows that the unset key is removed from the ‘Meta’ field, but remains in ‘Dynamic’. In our local reproduction, we inspected the RAFT state and confirmed that the scheduler does not track Meta keys with null values, so this issue is limited to client nodes.
The only way to clear unset keys from ‘Dynamic’ was to restart the node. In code, the client clones the ‘Dynamic’ meta map (code) and thus does not end up deleting the keys as we do in standard ‘Meta’.
We suspect that this behavior exists in order to be able to unset static Meta keys. However, keeping keys with null values which are not in ‘Static’ metadata seems meaningless and undesirable because the client accumulates memory indefinitely. Ideally we should only persist keys with null values if those same keys exist in ‘Static’ metadata.
Proposal
Persist ‘Dynamic’ metadata keys with null values only if those same keys exist in ‘Static’ metadata.
Reproduction steps
Start a local cluster with 1 client and 1 server, Nomad v1.5.5:
Add a “test-key” metadata with value null that doesn’t exist as static metadata:
$ echo "{\"Meta\": { \"test-key\": null}}" | nomad operator api /v1/client/metadata?node_id=NODE_ID
Expected Result
After waiting 10s,
$ nomad operator api /v1/client/metadata?node_id=NODE_ID
will not include test-key: null in the 'Dynamic' section of metadata since test-key is not in 'Static'.
Actual Result
Regardless of waiting 10s or send SIGHUP to your nomad client, the unset key remains in Dynamic:
Nomad version
We tested with Nomad v1.5.5, but we think this reproduces in tip.
Operating system and Environment details
Unix
Issue
Unsetting node metadata keys leave them as null on the client node until it restarts. This causes steady increase in memory, and there doesn’t seem to be another way of removing the keys otherwise.
Description
The Update Node Metadata HTTP API allows us to dynamically set key-value metadata. The documentation mentions that one can ‘unset’ keys by requesting updates with value=null.
After waiting 10s for the node data to be propagated to the scheduler, the response from Read Node Metadata HTTP API shows that the unset key is removed from the ‘Meta’ field, but remains in ‘Dynamic’. In our local reproduction, we inspected the RAFT state and confirmed that the scheduler does not track Meta keys with null values, so this issue is limited to client nodes.
The only way to clear unset keys from ‘Dynamic’ was to restart the node. In code, the client clones the ‘Dynamic’ meta map (code) and thus does not end up deleting the keys as we do in standard ‘Meta’.
We suspect that this behavior exists in order to be able to unset static Meta keys. However, keeping keys with null values which are not in ‘Static’ metadata seems meaningless and undesirable because the client accumulates memory indefinitely. Ideally we should only persist keys with null values if those same keys exist in ‘Static’ metadata.
Proposal
Persist ‘Dynamic’ metadata keys with null values only if those same keys exist in ‘Static’ metadata.
Reproduction steps
Start a local cluster with 1 client and 1 server, Nomad v1.5.5:
Add a “test-key” metadata with value null that doesn’t exist as static metadata:
$ echo "{\"Meta\": { \"test-key\": null}}" | nomad operator api /v1/client/metadata?node_id=NODE_ID
Expected Result
After waiting 10s,
$ nomad operator api /v1/client/metadata?node_id=NODE_ID
will not includetest-key: null
in the 'Dynamic' section of metadata sincetest-key
is not in 'Static'.Actual Result
Regardless of waiting 10s or send SIGHUP to your nomad client, the unset key remains in Dynamic: