#26511·vector

Newline-delimited framing: EOF flush of an unterminated buffer silently merges misframed events — no WARN or metric

Author: paveljandaCreated Sep 29, 2026Updated Sep 29, 2026

A note for the community

  • Please vote on this issue by adding a reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Use Cases

Current behavior

When a stream source using newline_delimited framing receives data that contains no delimiter and the connection closes, the decoder flushes the remaining buffer at EOF as one final frame — with no warning and no error metric.

If the producer was actually using a different framing (e.g. 4-byte length prefixes), this silently merges every frame into a single event with the raw protocol bytes embedded in message.

newline_delimited is the default framing for the socket source in TCP mode, so this configuration is what users get out of the box (cf. #11468).

Expected behavior

At minimum a WARN log line and/or an error/framing metric when decode_eof flushes a non-empty unterminated buffer, so a framing mismatch between the producer and the source is diagnosable instead of manifesting as silently corrupted data downstream.

The flush itself is reasonable — a trailing line without a final newline is common and benign. The problem is purely the absence of any signal.

Steps to reproduce

Config:

sources:
  in:
    type: socket
    mode: tcp
    address: 127.0.0.1:9000

sinks:
  out:
    type: console
    inputs: [in]
    encoding:
      codec: json

Send two length-prefixed frames and close the connection:

python3 -c "
import socket
s = socket.create_connection(('127.0.0.1', 9000))
s.sendall(b'\x00\x00\x00\x05hello\x00\x00\x00\x05world')
s.close()
"

Result: one event:

{"message":"\u0000\u0000\u0000\u0005hello\u0000\u0000\u0000\u0005world", ...}

No WARN/ERROR in the Vector logs; component_errors_total unchanged. With framing.method = "length_delimited" the same payload produces two clean events (hello, world).

Root cause

lib/codecs/src/decoding/framing/character_delimited.rs — decode_eof returns the remaining buffer as a final frame. A WARN exists on the max_length oversize path, but the EOF-flush path has none.

Context

  • Framing mismatches are a realistic misconfiguration: any binary or length-prefixed producer pointed at the default framing hits this on first use, with zero feedback.
  • The failure mode is silent data corruption — data flows, nothing is dropped, no log, no metric. It surfaces only as odd-looking events in the destination, with nothing to correlate them with the framing setting.
  • Framing-level warnings already have precedent (the max_length oversize WARN), and the metrics infrastructure exists (component_errors_total{error_type, stage} / component_discarded_events_total{intentional}).

A blanket WARN on every EOF flush would be noisy for the benign trailing-line case (files without a final newline), so some design options:

  1. WARN + error metric on every EOF flush of a non-empty buffer, possibly restricted to stream sources (socket, http) where producers normally terminate every frame.
  2. WARN only when the flushed frame contains non-UTF-8 / non-printable bytes — separates misframed binary from a benign trailing text line.
  3. A dedicated counter only (no log), queryable without log noise.

Reproduced on Vector 0.55.0; the EOF-flush path in character_delimited.rs is unchanged on master (checked 2026-09-29).

Attempted Solutions

No response

Proposal

No response

References

No response

Version

No response