Skip to content

fix(feeders): degrade on recent lossy lines, match host-only DNS failures (#375, #376) - #403

Merged
stevenpickles merged 4 commits into
devfrom
140-feeder-loss-window-dns
Nov 30, 2026
Merged

stevenpickles merged 4 commits into
devfrom
140-feeder-loss-window-dns

Conversation

@stevenpickles

@stevenpickles stevenpickles commented Nov 30, 2026 •

Copy link
Copy Markdown
Owner

Summary

Slice 140 covers issues #375 and #376. Both are follow-ups of slice 127 (#372) in feeders/ultrafeeder.py.

What readsb does (net_io.c, wiedehopf/readsb bc57f2ddd83016e5628f63012eea1a51155623a5)

  • dropHalfUntil (:1530-1551)
    • It computes N = 100 - bytesSent/bytesFromWriter*100 and prints it with %4.1f. Both counters are per client and start at zero when the connection opens.
    • It prints only when now > dropHalfAntiSpam and then pushes that time 300 s ahead (10 s under --debug net, 2 s under --debug flush).
    • Without --debug net / --debug flush, it never prints in a connection's first 10 s (:1534).
    • So readsb writes one line about every 300 s while trouble lasts, and one line for a short episode.
  • Name resolution for %s failed: %s (:626-633)
    • It names the host only, with no port.
    • It is printed on every failed resolve unless silent_fail is set. The connect-error suppression does not apply to it.
    • serviceConnect runs only for a connector that is not connected (:740, :755). A failed resolve returns before any socket exists.
  • <host> port <n>: Ignoring this DNS reply: 0.0.0.0|:: (:662-672)
    • The connect attempt is abandoned. The next attempt tries the next address if there is one; otherwise readsb resolves again.
  • Benign notes
    • Attempting connection to … (:684, --debug net only).
    • setSockopts's Unable to set TCP_NODELAY / Unable to set keepalive (:277, :284).

Binding rulings, and how they are implemented

  1. No numeric "current %". None is published. The module docstring, API.md and the ADR say why: the bytes offered between two lines are not logged, and at %4.1f a two-second half-drop on a connection older than about half an hour does not move N at all.

  2. adsb_out_loss_pct stays the lifetime figure. detail.adsb_out_lossy_lines_recent is new: the number of the current connection's lossy lines within LOSSY_RECENT_MS (15 min).

  3. When the feed reads degraded. While the connection is up, the feed is degraded when either holds:

    • at least 2 lossy lines of the current connection fall within LOSSY_RECENT_MS (LOSSY_RECENT_LINES = 2);
    • N rose since the previous lossy line on the same connection.

    LOSSY_DEGRADED_PCT is removed. Messages:

    • "ADS-B output dropping data (2 warnings in the last 15 min; 4.2% lost since it connected)"
    • "ADS-B output dropping data (the share lost since it connected rose from 1.0% to 4.2%)"

    Both reasons are joined when both hold.

    The rise rule also requires the newest lossy line to be within LOSSY_RECENT_MS (endorsed in review). The previous lossy line may be older than the window.

  4. Host-only DNS line (Feeders: readsb lines without a port are never matched (DNS failure) or warn forever (Ignoring this DNS reply) #376).

    • beast_line_matcher also selects Name resolution for <host> failed: by exact host. That covers every feed configured on that host and no other host; adsbexchange.com does not match feed.adsbexchange.com.
    • classify_beast_line classes the line closed.
    • Review fix: the line never replaces an established state, whether held from an earlier read or set earlier in the same read, because it can only be a sibling connector's. It closes a feed whose state is unknown or already closed.
    • Tested with two feeds on one host (ports 30004 and 30005) plus a feed on another host, both with the shared feed closed and with it open.
  5. "Ignoring this DNS reply" is closed (review fix). It names host and port and abandons the attempt. A feed sinkholed to 0.0.0.0 logs nothing else, so as benign it would read unknown for ever.

  6. Benign lines (Feeders: readsb lines without a port are never matched (DNS failure) or warn forever (Ignoring this DNS reply) #376). A new benign kind covers "Attempting connection" and the TCP_NODELAY / keepalive notes. These lines are skipped without a warning and never move the state.

Other changes

  • The probe keeps a list of the current connection's lossy lines, pruned to the two newest plus those inside the window.
  • A newer state line drops older entries.
  • A lossy line re-read through the 5 s overlap is recognised by (time, text). It is neither counted twice nor compared with itself.
  • Every lossy line after the last state line in a read is applied, not just the newest one.

Out of scope

The "port {n}" / host in line substring matching is tracked as #406.

Docs

  • Module docstring: the four kinds, and a new section "When a lossy line degrades (issue Feeders: Beast-output loss shown as a lifetime share; estimate a current rate instead #375)".
  • docs/API.md feeder section.
  • ADR-0017 amendment note (2026-11-30, slice 140). The slice-127 1.0% paragraph is marked superseded.
  • Fixture readsb_beast_lines.tsv, extended and cited by line number:
    • two DNS-failure and two "Ignoring this DNS reply" rows, all closed;
    • three benign rows;
    • the unrecognised row is now pthread_create ERROR (:598).

Tests

New or rewritten tests in tests/feeders/test_vendors.py:

  • two recent lossy lines degrade, then the feed is up once one has aged out;
  • a single lossy line (50%) stays up;
  • the Feeders: Beast-output loss shown as a lifetime share; estimate a current rate instead #375 example: two-day connection, 0.1% → 0.2% → degraded;
  • a rise across reads, including the overlap re-read, and aging;
  • a falling N stays up;
  • the lossy-only tail is still unknown;
  • MLAT unwell plus lossy;
  • lossy lines do not outlive their connection, and the new connection's first line is not compared with the old N;
  • the DNS matcher;
  • a rise over a previous lossy line days old (0.1% → 0.2%) degrades;
  • DNS downs both feeds on a shared host and leaves the other host alone;
  • a DNS line never closes the open feed on a shared host, whether its established line came in the same read or an earlier one, while the closed sibling reads down;
  • an "Ignoring this DNS reply" tail reads a sinkholed feed down;
  • a DNS-only tail reads down;
  • benign lines produce no warning and no state change.

The fixture-parametrized classification test covers all new rows. The reference-install (#369) replay still reads up.

Run locally:

  • uv run pytest tests/feeders -q --no-cov: 218 passed
  • uv run ruff check .: clean
  • uv run ruff format --check .: clean
  • uv run mypy: no issues (582 files)

Closes #375
Closes #376

🤖 Generated with Claude Code

https://claude.ai/code/session_01JFZvpNYnicPHv6pjHTVK2f

stevenpickles and others added 2 commits November 30, 2026 17:17
…ures

readsb's lossy-line N is a lifetime share of the connection; a current
rate cannot be derived from its lines (net_io.c:1530-1551 at bc57f2dd), so
none is published. The feed now reads degraded while connected when two
lossy lines of the current connection fall within 15 min, or when the
newest is recent and its N rose over the previous one's. The 1.0%
threshold is gone; detail.adsb_out_lossy_lines_recent is added next to
the lifetime adsb_out_loss_pct (#375).

"Name resolution for <host> failed" names no port; it is now matched by
host for every configured feed on that host and classed closed. Known
benign readsb notes (Ignoring this DNS reply, Attempting connection,
TCP_NODELAY/keepalive) are ignored without a warning (#376).

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
stevenpickles and others added 2 commits November 30, 2026 17:25
…S reply is closed

Review of #403. serviceConnect runs only for a connector that is not
connected (net_io.c:740, :755) and a failed resolve returns before any
socket exists (:626-633), so a host-only "Name resolution … failed" line
never describes a feed held as established: it no longer replaces an
established state, held or set earlier in the same read.

"Ignoring this DNS reply" (:662-672) abandons the connect attempt and
names host and port; it is now closed, not benign, so a feed sinkholed to
0.0.0.0 reads down instead of unknown for ever.

Also: qualify the first-10-s rule by the debug flags (:1534), cite
pthread_create ERROR at :598, mark the slice-127 ADR paragraph superseded,
test a rise over a lossy line outside the window, cite #406.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JFZvpNYnicPHv6pjHTVK2f
# Conflicts:
#	planning/roadmap.yaml
@stevenpickles
stevenpickles merged commit dea2934 into dev Nov 30, 2026
14 checks passed
@stevenpickles
stevenpickles deleted the 140-feeder-loss-window-dns branch December 1, 2026 00:31
@stevenpickles stevenpickles mentioned this pull request Dec 1, 2026
21 of 28 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant