Skip to content

Read cloud metadata replies once they're complete, so Hetzner machines get their provider - #24

Merged
liamdevss merged 1 commit into
mainfrom
fix/metadata-early-close
Nov 17, 2026
Merged

liamdevss merged 1 commit into
mainfrom
fix/metadata-early-close

Conversation

@liamdevss

Copy link
Copy Markdown
Contributor

Hetzner machines showed as Other in the panel's Provider column.

When the daemon starts it asks the cloud's metadata service (169.254.169.254) where it's running. Hetzner's answers straight away but then keeps the connection open, despite Connection: close (try it with nc on a Hetzner box: the reply arrives, then it sits until nc gives up). The daemon used read_to_end, which waits for the server to hang up, so every lookup hit the 150 ms read timeout and the reply that had already arrived was thrown away.

Now a reply ends at its Content-Length or its last chunk. One with neither still ends when the server closes, a reply cut short is never used, and no single request takes longer than a second however slowly it trickles in.

Tests: a local server that answers and then holds the connection open (as Hetzner's does) for a Content-Length reply and a chunked one, plus replies cut short, replies with no framing, extra bytes past Content-Length, and a 404.

cargo test -p daemon-telemetry and cargo clippy -p daemon-telemetry --all-targets -D warnings pass.

…for the server to hang up

Hetzner's metadata service sends the whole reply and then keeps the
connection open, despite Connection: close. The daemon read until the
server closed, so every lookup ran into the read timeout, the reply was
thrown away, and Hetzner machines showed as Other. Replies now end at
their Content-Length or last chunk; one without either still ends when
the server closes, and no request takes longer than a second.
@liamdevss
liamdevss requested a review from a team as a code owner November 17, 2026 01:27
@liamdevss
liamdevss merged commit 654336f into main Nov 17, 2026
12 checks passed
@liamdevss
liamdevss deleted the fix/metadata-early-close branch November 17, 2026 01:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant