apache/seatunnel · critical · EdgeSocketConnectorException

SOURCE_REOPEN_EXHAUSTED

SOURCE_REOPEN_EXHAUSTED

Error message

Bind edge socket ingress 0.0.0.0:%s failed after exhausting retries

What it means

The edge-socket ingress server could not bind its listening socket on 0.0.0.0:<port> and exhausted its retry budget. Each bind attempt's IOException is consumed against a limited retry budget; once the budget is empty, receiveLoop throws SOURCE_REOPEN_EXHAUSTED. This fails the source because without a bound server socket no data can be received.

Source

Thrown at seatunnel-connectors-v2/connector-edge-socket/src/main/java/org/apache/seatunnel/connectors/seatunnel/edgesocket/source/EdgeSocketIngressServer.java:120

        int attempt = 1;
        while (isReceiverActive()) {
            try {
                serverSocket = new ServerSocket();
                serverSocket.setReuseAddress(true);
                serverSocket.bind(new InetSocketAddress(config.getPort()));
                serverSocket.setSoTimeout(config.getAcceptTimeoutMs());
                remainingOpenRetries = config.getMaxNumRetries();
                log.info(
                        "Edge socket ingress started, bind host:[{}], port:[{}], endpoint:[{}], attempt:[{}]",
                        "0.0.0.0",
                        config.getPort(),
                        config.getEndpoint(),
                        attempt);
                return;
            } catch (IOException bindException) {
                closeServerSocketQuietly();
                if (!tryConsumeRetryBudget(bindException)) {
                    throw new EdgeSocketConnectorException(
                            EdgeSocketConnectorErrorCode.SOURCE_REOPEN_EXHAUSTED,
                            String.format(
                                    "Bind edge socket ingress %s:%s failed after exhausting retries",
                                    "0.0.0.0", config.getPort()),
                            bindException);
                }
                attempt++;
                if (isInterruptedDuringRetryWait()) {
                    return;
                }
            }
        }
    }

    private void closeServerSocket() throws IOException {
        ServerSocket current = serverSocket;
        serverSocket = null;
        if (current != null) {

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Check what occupies the port (netstat/ss/lsof) and stop it or change config port to a free one.
  2. Ensure no duplicate/stale edge-socket job instance is still running and holding the socket.
  3. Wait for the OS to release the socket after a restart, or enable SO_REUSEADDR semantics / lower restart rate.
  4. Verify the runtime environment allows binding on 0.0.0.0 (container network, security policies, privileged ports <1024 need privileges).

Example fix

// before
port = 5100 // already used by another process
// after
port = 15210 // free port, or stop the conflicting process
Defensive patterns

Strategy: retry

Validate before calling

// before starting the job
Socket s = new Socket();
boolean free = true;
try { s.bind(new InetSocketAddress(0, config.getPort())); } catch (IOException e) { free = false; } finally { s.close(); }
if (!free) throw new IllegalStateException("port " + config.getPort() + " already in use");

Try / catch

try {
    source.open();
} catch (EdgeSocketConnectorException e) {
    if (e.getCode() == SOURCE_REOPEN_EXHAUSTED) {
        log.error("bind failed repeatedly; port likely in use", e);
        // alert operator or switch to a fallback port from config
    }
}

Prevention

When it happens

Trigger: openServerSocketWithRetry (called from receiveLoop) repeatedly fails to bind because the port is already in use, the address is unavailable, or permissions are missing, until tryConsumeRetryBudget returns false.

Common situations: Another instance of the job (or a stale process) already holds the port; port conflicts with a system service; running in a container where 0.0.0.0 binding is restricted; rapid job restart before the OS releases the socket (TIME_WAIT).

Related errors


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