apache/seatunnel · warning

Rejected edge collector from

Error message

Rejected edge collector from {}: another collector is already connected

What it means

Warned by serveOneCollector() when a new collector connection arrives while hasActiveCollector is true. The edge-socket source allows only one collector connection at a time, so the new one is refused with the REJECTED response code and closed. This enforces single-writer semantics on the ingress port.

Solutions

  1. Ensure exactly one collector instance targets this edge-socket source port.
  2. Add reconnect backoff/jitter on the collector so it does not hammer the port while the previous connection is still considered active.
  3. If the old collector is truly dead, fix/disable keepalive/idle detection so hasActiveCollector clears promptly, or restart the source to free the slot.
  4. Dedicate a separate port for health checks instead of reusing the ingress port.

Example fix

// before (collector)
while (!connected) { reconnect(); } // tight reconnect loop, second connection
// after
while (!connected) { reconnect(); Thread.sleep(backoffMs); backoffMs = Math.min(backoffMs * 2, maxMs); }
Defensive patterns

Strategy: retry

Validate before calling

// collector-side check before connecting
if (anotherCollectorProcessHoldsPort(host, port)) { throw new IllegalStateException("edge-socket port already served by another collector"); }

Try / catch

String resp = channel.readLine(); if (EdgeSocketResponseCode.REJECTED.getCode().equals(resp)) { scheduleReconnectWithBackoff(); }

Prevention

When it happens

Trigger: A second TCP connection is accepted while another collector is being served — e.g. duplicate collector instance, aggressive reconnect after a network blip while the old connection lingers, or a monitoring probe connecting to the same port.

Common situations: Two collector processes (or replicas) pointed at the same edge-socket port, collector's reconnect backoff shorter than the server's detection of a dead connection, ops port-scanning the ingress port.

Understand the failure class

Background: ECONNREFUSED and "connection refused" / "could not connect to server" errors: what they mean and how to fix them — this error's family across 44 libraries.

Related errors


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

Appendix: source

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

            }
        }
        log.warn("Edge socket receiver loop exception, retrying", e);
        return isInterruptedDuringRetryWait();
    }

    private void serveOneCollector() throws IOException {
        ServerSocket ss = serverSocket;
        if (ss == null || ss.isClosed()) {
            return;
        }

        Socket raw = ss.accept();
        raw.setSoTimeout(config.getAcceptTimeoutMs());
        try (IngressChannel channel = new BlockingIngressChannel(raw)) {
            log.info("Accepted edge collector connection from {}", channel.remoteAddress());
            if (hasActiveCollector) {
                log.warn(
                        "Rejected edge collector from {}: another collector is already connected",
                        channel.remoteAddress());
                channel.writeLine(EdgeSocketResponseCode.REJECTED.getCode());
                return;
            }
            activateAndServe(channel);
        }
    }

    private void activateAndServe(IngressChannel channel) throws IOException {
        hasActiveCollector = true;
        try {
            if (!protocolHandler.authenticate(channel)) {
                return;
            }
            closeServerSocket();
            protocolHandler.receiveLoop(channel, this::isReceiverActive);
        } finally {
            hasActiveCollector = false;

View on GitHub (pinned to cf67b549a7)