Repository navigation
fix(feeders): readsb lossy Beast-output warning reads degraded, not down (#369) - #372
Merged
Merged
Conversation
…ot down readsb's "Bad connection, dropping data (connection lost N% of data)" warning is logged on an open Beast output, but beast_connected() took every non-"Connection established" line as a disconnect, so a first read after a restart reported both ultrafeeder feeds down for days (#369). Matched lines are now classified from readsb's own wording (net_io.c at wiedehopf/readsb bc57f2dd): established, closed (remote disconnect, send error/timeout, heartbeat reconnect, failed or timed-out connect), lossy, or unrecognised. Only established/closed lines set connected and since; a lossy line reports N (cumulative since the connection opened) as detail.adsb_out_loss_pct and degrades the feed while it is at most 15 min old with N >= 1.0%; an unrecognised line keeps the verdict and is warned about once. Refs #369 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JFZvpNYnicPHv6pjHTVK2f
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JFZvpNYnicPHv6pjHTVK2f
…ds; state the cumulative-N limit Per Fable review of PR #372: dated amendment notes (2026-11-30, slice 127, #369) in ADR-0017 and docs/design/077-feeders-page.md; the cumulative-N limitation stated at the threshold (constant, module docstring, API.md); the degraded message now reads 'N% lost since it connected'; the lossy line's second source (a remote W S reduce command) noted; unrecognised lines deduplicated within one read as well as across the overlap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JFZvpNYnicPHv6pjHTVK2f
This was referenced Nov 30, 2026
Merged
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.
Summary
Slice 127. readsb's periodic
Bad connection, dropping data (connection lost N% of data) (suppress msg for 300 s)warning is logged on an open Beast output.beast_connected()treated every line that was notConnection establishedas a disconnect. So after a restart, the first read showed both ultrafeeder feeds down, and they stayed that way until readsb next reconnected, which can take days (#369).What readsb actually logs (net_io.c, wiedehopf/readsb
bc57f2ddd83016e5628f63012eea1a51155623a5, 2026-11-27; this is also the newest commit touching net_io.c as of today)checkServiceConnected:<descr>: Connection established: <host>[ (<ip>)] port <n>[ (sent UUID)]modesCloseClientor the socket being closed):readClient:Remote server disconnected: <host> port <n> (fd …)flushClient:Send Error: <err>: …,Couldn't send any data for 5.00s (Insufficient bandwidth?): disconnecting: …,send() weirdness: …serviceReconnectCallback:No data or heartbeat received for N seconds, reconnecting: …readClient:Socket Error: …(--debug netonly)Connection to <host>[ (<ip>)] port <n> failed: …/failed (k): …/timed out./failed k times, suppressing most error messages until connection succeedsdropHalfUntil:<host> port <n>: Bad connection, dropping data (connection lost %4.1f%% of data) (suppress msg for %d s). The connection stays open, and readsb drops every other chunk for a while.dropHalfUntilis called on a write shortfall (flushClient/flushWrites, 2 s) and when the remote sends aW Sreduce command (net_io.c:4590). N is cumulative since the connection opened:100 - bytesSent/bytesFromWriter*100, and both counters are per-client fields zeroed by thememsetincreateSocketClient. The line is printed when dropping starts, at most once every 300 s, and never in the connection's first 10 s.Rulings
classify_beast_linereturns established / closed / lossy / unrecognised. Only established and closed lines setconnectedandsince_ms. A first read with no state line in the tail givesconnected=None, the existing semantics (test: lossy-only tail).degradedwith "ADS-B output dropping data (N% lost since it connected)" when the newest lossy line of the current connection is ≤ 15 min old (LOSSY_RECENT_MS) and N ≥ 1.0 (LOSSY_DEGRADED_PCT). Otherwise it stays up.detail.adsb_out_loss_pctcarries N whenever the output is connected and a loss figure is known. A close, or a newer established line, drops the previous connection's figure.adsb_out.connectedstays true andlast_data_sent_msis unchanged. TheAdsbOutStatusAPI shape and the stored metrics are unchanged. With MLAT also unwell, the state is stilldegradedand both reasons are joined in the message.feeder_adsb_out_unrecognised_linewith the text and timestamp. Lines are deduplicated on (text, ts) against the previous read, which covers the 5 s overlap. Repeats of the same line within one read are deduplicated too. The Feeders: ADS-B Exchange and AeroDataBox shown offline for hours while both feeds were up (silent ultrafeeder log) #276 silent-log rule is untouched.feeder_adsb_out_transitionnow carrieskindand is also emitted for lossy lines, withloss_pct.adsb_out). ADR-0017 (l.34) and docs/design/077-feeders-page.md (l.24) each get a dated amendment note (2026-11-30, slice 127, Feeders: readsb 'Bad connection, dropping data' warning marks an open Beast output as down #369).Known limitation (documented at the threshold: the constant, the module docstring and API.md): N is a lifetime share of the connection, not a current rate. On a long-lived connection, a fresh severe episode may never reach 1.0% and reads up; ten minutes of half-drop on a two-day connection is about 0.2%. A connection that lost data early reads degraded for 15 min on any later 2 s hiccup. A young connection overstates its loss.
Tests
backend/tests/feeders/fixtures/readsb_beast_lines.tsvhas one row per readsb wording, cited to the commit above. It includes the reference install's verbatim 0.0% line. A parametrized test checks that each row is matched and classified by its kind.2026-11-30T13:25:39Z(established on 11-28, a 0.0% warning that evening): both feeds read up, withsinceset to the established line's time andadsb_out_loss_pct = 0.0. This holds for two fresh probes, before and after a restart. The state is neverdown, so no "Feed offline" self-alert (which onlydownraises).ultrafeeder.logused an inventedConnection refused: <host> … portline. It now uses readsb's realConnection to <host> (ip) port 30004 failed (1): 111 (Connection refused).Run locally:
uv run pytest tests/feeders -q --no-cov: 203 passeduv run ruff check .: clean;uv run ruff format --check .: clean;uv run mypy: no issues (577 files)Discovered (not in scope)
Name resolution for <host> failedline has no port, so the matcher never sees it. A feed whose DNS fails before any connect attempt keeps its previous verdict until aConnection to … failedline appears. This is unchanged behaviour.Closes #369
🤖 Generated with Claude Code
https://claude.ai/code/session_01JFZvpNYnicPHv6pjHTVK2f