Repository navigation
Read cloud metadata replies once they're complete, so Hetzner machines get their provider - #24
Merged
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 withncon a Hetzner box: the reply arrives, then it sits until nc gives up). The daemon usedread_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-Lengthor 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-Lengthreply and a chunked one, plus replies cut short, replies with no framing, extra bytes pastContent-Length, and a 404.cargo test -p daemon-telemetryandcargo clippy -p daemon-telemetry --all-targets -D warningspass.