apache/seatunnel · error · SnmpConnectorException

POLL_FAILED

POLL_FAILED

Error message

Failed to poll SNMP agent {host}:{port}

What it means

SnmpSourceReader.pollNext() polls the agent via client.get(config.getOids()); an IOException there becomes SnmpConnectorException with POLL_FAILED. If the reader is already closed, the IOException is swallowed (return) instead of throwing — so this error only surfaces on a live reader whose poll failed (timeout, agent error).

Source

Thrown at seatunnel-connectors-v2/connector-snmp/src/main/java/org/apache/seatunnel/connectors/seatunnel/snmp/source/SnmpSourceReader.java:109

        }

        if (Boundedness.UNBOUNDED.equals(context.getBoundedness())) {
            long waitMillis = nextPollTimeMillis - currentTimeMillis.getAsLong();
            if (waitMillis > 0) {
                Thread.sleep(Math.min(waitMillis, MAX_IDLE_WAIT_MILLIS));
                return;
            }
        }

        long pollTime = currentTimeMillis.getAsLong();
        List<SnmpRecord> records;
        try {
            records = client.get(config.getOids());
        } catch (IOException e) {
            if (closed) {
                return;
            }
            throw new SnmpConnectorException(
                    SnmpConnectorErrorCode.POLL_FAILED,
                    "Failed to poll SNMP agent " + config.getHost() + ":" + config.getPort(),
                    e);
        }

        if (closed) {
            return;
        }
        synchronized (output.getCheckpointLock()) {
            for (SnmpRecord record : records) {
                output.collect(
                        new SeaTunnelRow(
                                new Object[] {
                                    config.getHost() + ":" + config.getPort(),
                                    record.getOid(),
                                    record.getValue(),
                                    record.getValueType(),
                                    pollTime

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Check the wrapped cause to distinguish timeout from agent error status, then apply the matching fix (connectivity vs OID/ACL).
  2. Increase the SNMP timeout/retries so transient loss does not fail the poll.
  3. Enable source-level retry/resume via checkpointing so the job recovers after agent blips.
  4. Confirm the agent's uptime/availability over the job's duration (monitoring, snmpd logs).
  5. Review config.getOids() validity if the wrapped error is an agent error status.

Example fix

// before
pollInterval = 1000ms, snmp timeout = 500ms, retries = 0
// after
pollInterval = 5000ms, snmp timeout = 3000ms, retries = 2
Defensive patterns

Strategy: retry

Validate before calling

// health probe before starting a long-running poll loop
snmpCli("snmpget -v2c -c " + community + " -t 3 -r 2 " + host + " " + oids.get(0));

Try / catch

try {
    reader.pollNext();
} catch (SnmpConnectorException e) {
    if (e.getCode() == SnmpConnectorErrorCode.POLL_FAILED && isTransient(e.getCause())) {
        scheduleRecoveryWithBackoff();
    } else throw e;
}

Prevention

When it happens

Trigger: Calling pollNext() on a non-closed SnmpSourceReader when client.get() throws IOException — SNMP GET timeout (2415) or agent error status (2416). Exceptions during close-triggered polls are suppressed.

Common situations: Agent rebooted or network partition mid-streaming job; intermittent packet loss between worker and agent; polling interval tighter than agent response time causing stress; wrong community after agent reconfiguration.

Understand the failure class

Background: Request timed out: what client-side request timeouts mean across libraries (Request timed out, TIMED_OUT, APITimeoutError) — this error's family across 39 libraries.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/f80d3edfb8581019. Report an issue: GitHub.