Skip to content

No retry on unwritten events to TCP-output #297

@semyonkozlov

Description

@semyonkozlov

Setup

1 running openwec daemon that receiving events from Windows machine.
Config:

[[collectors]]
listen_address = "0.0.0.0"
listen_port = 5985

[collectors.authentication]
type = "Tls"
ca_certificate = "/mnt/persist/openwec-certs/ca-cert.pem"
server_certificate = "/mnt/persist/openwec-certs/server-cert.pem"
server_private_key = "/mnt/persist/openwec-certs/server-key.pem"

[logging]
verbosity = "info"
server_logs = "stdout"
access_logs = "stdout"

[database]
type = "SQLite"
path = "/var/lib/openwec/db/openwec.sqlite"

[monitoring]
listen_address = "0.0.0.0"
listen_port = 9090

1 active subscription:

Subscription test-tcp-json
        UUID: b199461f-1394-4e90-b03a-8b14d7e2d93d
        Internal version: 06bc69ad-ae36-480f-a75c-7f30e4d8524a
        Public version: d52e481e-723c-bfe8-d52e-481e723cbfe8
        Revision: Not configured
        URI: Not configured
        Heartbeat interval: 3600s
        Connection retry count: 5
        Connection retry interval: 60s
        Max time without heartbeat/events: 5s
        Max events in a batch: Not configured
        Max envelope size: 512000 bytes
        Read existing events: false
        Content format: Raw
        Ignore channel error: true
        Locale: Not configured
        Data Locale: Not configured
        Principal filter: Not configured
        Outputs:
        - 0: Enabled: true, Format: json, Driver: Tcp(TcpConfiguration { host: "localhost", port: 5000, tls_enabled: false, tls_certificate_authorities: [], tls_certificate: None, tls_key: None })
        Enabled: true
        Event filter query:

<QueryList><Query Id="0" Path="System"><Select Path="System">*</Select></Query></QueryList>

Receiving events on localhost with socat:

socat TCP-LISTEN:5000,reuseaddr,fork -

Problem

Loosing events that were sent while socat server is down.

How to reproduce

  1. Run socat
  2. Receive some events
  3. Ctlr+C socat
  4. Wait for Broken pipe message in openwec logs
WARN server::logic - Failed to process output and send event: Failed to write event to output format: Json, driver: Tcp(TcpConfiguration { host: "localhost", port: 5000, tls_enabled: false, tls_certificate_authorities: [], tls_certificate: None, tls_key: None })
Caused by:
     Failed to write in TCP connection (localhost:5000): Broken pipe (os error 32)
  1. Run socat
  2. Receive some events, confirm gap
$ socat TCP-LISTEN:5000,reuseaddr,fork - | jq | grep EventRecordID
    "EventRecordID": 40886,
    "EventRecordID": 40887,
    "EventRecordID": 40888,
    "EventRecordID": 40889,
    "EventRecordID": 40890,
    "EventRecordID": 40891,
    "EventRecordID": 40892,
    "EventRecordID": 40893,
^C
$ socat TCP-LISTEN:5000,reuseaddr,fork - | jq | grep EventRecordID
    "EventRecordID": 40902,
    "EventRecordID": 40903,
    "EventRecordID": 40904,
    "EventRecordID": 40905,
    "EventRecordID": 40906,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions