Skip to content

fix(s3 sink): encoding failures after split_input silently ack batches as delivered #25191

@pront

Description

@pront
  • 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

Problem

When encoding fails in the S3 sink request builder, the batch is silently acknowledged as delivered upstream, causing undetected data loss.

What currently happens: If an event batch fails to encode (e.g., schema violation, serialization error), the error is logged via SinkRequestBuildError but the batch finalizers are dropped without signaling failure. Dropping finalizers defaults to signaling success, so upstream components (sources with end-to-end acknowledgements) believe the data was delivered.

What should happen: Encoding failures should reject the batch finalizers so upstream components know the data was not delivered and can retry or report the failure.

The root cause is in the request builder flow:

  1. split_input (src/sinks/aws_s3/sink.rs) calls events.take_finalizers() and stores them in S3Metadata before encoding
  2. encode_events is called after finalizers are already taken
  3. If encoding fails, src/sinks/s3_common/sink.rs:55-62 catches the error via filter_map, logs it, and returns None
  4. The S3Metadata (owning the finalizers) is dropped, which signals successful delivery

This is a pre-existing issue that becomes more impactful as new encoding formats (Parquet, Arrow) introduce more encode-time failure modes (strict schema violations, type coercion errors, etc.).

Configuration

Any S3 sink configuration where encoding can fail at runtime, e.g.:

sinks:
  s3:
    type: aws_s3
    bucket: my-bucket
    batch_encoding:
      codec: parquet
      schema_mode: strict
      schema_file: /path/to/schema.schema
    encoding:
      codec: text

Version

0.54.0

Debug Output

The only observable signal is a SinkRequestBuildError log line. No acknowledgement failure is reported upstream.

Additional Context

This affects any sink using the RequestBuilder pattern in src/sinks/util/request_builder.rs where encoding happens after split_input takes finalizers. The S3 sink is the most notable case.

Possible fixes:

  • Move encoding before finalizer extraction so failures can reject the batch properly
  • Explicitly reject finalizers (signal failure) when encoding fails, rather than dropping them silently

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    sink: aws_s3Anything `aws_s3` sink related

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions