apache/seatunnel · error · IOException

SNMP SET request timed out for agent {host}:{port}

Error message

SNMP SET request timed out for agent {host}:{port}

What it means

Snmp4jSetClient.set() sends an SNMP SET PDU to the configured agent and waits for a ResponseEvent. If the event or its response is null, SNMP4J gave up waiting for a reply (timeout or transport failure), so the client cannot confirm the write and throws this IOException. It signals the agent was unreachable or did not answer within the retry/timeout window.

Source

Thrown at seatunnel-connectors-v2/connector-snmp/src/main/java/org/apache/seatunnel/connectors/seatunnel/snmp/sink/Snmp4jSetClient.java:65

            createdTarget = SnmpTargetFactory.create(config);
            snmp.listen();
        } catch (IOException | RuntimeException e) {
            try {
                snmp.close();
            } catch (IOException closeException) {
                e.addSuppressed(closeException);
            }
            throw e;
        }
        this.target = createdTarget;
        this.snmp = snmp;
    }

    @Override
    public void set(SnmpSetRequest request) throws IOException {
        ResponseEvent event = snmp.send(buildSetRequest(request), target);
        if (event == null || event.getResponse() == null) {
            throw new IOException(
                    "SNMP SET request timed out for agent "
                            + config.getHost()
                            + ":"
                            + config.getPort());
        }

        PDU response = event.getResponse();
        if (response.getErrorStatus() != PDU.noError) {
            throw new IOException(
                    "SNMP agent returned error status "
                            + response.getErrorStatus()
                            + " ("
                            + response.getErrorStatusText()
                            + ") at index "
                            + response.getErrorIndex());
        }
    }

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Verify config.getHost()/config.getPort() point at a reachable SNMP agent (ping, telnet/nc on UDP 161).
  2. Confirm the community string / SNMPv3 USM credentials and security level match the agent; agents silently drop unauthorized SETs.
  3. Increase SNMP timeout and retries in the target built from SnmpSinkConfig so slow agents can respond.
  4. Check agent-side ACLs (snmpd rocommunity/rwcommunity, view rules) to ensure SET is permitted, not just GET.
  5. Capture traffic with tcpdump/wireshark to confirm the request leaves and whether a response returns.

Example fix

// before
SnmpSinkConfig config = SnmpSinkConfig.of("10.0.0.5", 161, "public", 500, 1);
// after
SnmpSinkConfig config = SnmpSinkConfig.of("10.0.0.5", 161, "private-write-community", 5000, 3);
Defensive patterns

Strategy: retry

Validate before calling

// pre-check reachability of the SNMP agent (UDP 161)
InetAddress addr = InetAddress.getByName(config.getHost());
if (addr == null) throw new IllegalArgumentException("Unresolvable SNMP host: " + config.getHost());
// verify a GET works before attempting SET
snmpGetProbe(config.getHost(), config.getPort(), config.getCommunity(), 5000);

Try / catch

try {
    client.set(request);
} catch (IOException e) {
    if (isTimeout(e)) retryWithBackoff(request, 3);
    else throw new JobExecutionException("SNMP SET aborted: " + config.getHost(), e);
}

Prevention

When it happens

Trigger: Calling Snmp4jSetClient.set(SnmpSetRequest) when snmp.send() returns null (transport error) or a ResponseEvent with getResponse()==null (request timed out after retries) for agent host:port.

Common situations: Wrong agent host/port in config; SNMP agent down or firewall dropping UDP 161; community string accepted but agent silently discards SET; SNMPv3 credentials wrong so agent ignores requests; timeout/retry config too aggressive for a slow agent.

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/438f2ae1e78ba833. Report an issue: GitHub.