apache/seatunnel · warning

Failed to start replication stream at {}, waiting for {} ms

Error message

Failed to start replication stream at {}, waiting for {} ms and retrying, attempt number {} over {}

What it means

startStreaming attempted to open a WAL replication stream (START_REPLICATION) and got a transient/retryable failure (e.g. 'replication slot is active'). It logs a warning, sleeps delay ms via Metronome, and retries up to maxRetries times before throwing a DebeziumException.

Source

Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-opengauss/src/main/java/io/debezium/connector/postgresql/connection/PostgresReplicationConnection.java:417

            LOGGER.debug("starting streaming from LSN '{}'", lsn);
        }

        final int maxRetries = connectorConfig.maxRetries();
        final Duration delay = connectorConfig.retryDelay();
        int tryCount = 0;
        while (true) {
            try {
                return createReplicationStream(lsn, walPosition);
            } catch (Exception e) {
                String message = "Failed to start replication stream at " + lsn;
                if (++tryCount > maxRetries) {
                    if (e.getMessage().matches(".*replication slot .* is active.*")) {
                        message +=
                                "; when setting up multiple connectors for the same database host, please make sure to use a distinct replication slot name for each.";
                    }
                    throw new DebeziumException(message, e);
                } else {
                    LOGGER.warn(
                            message + ", waiting for {} ms and retrying, attempt number {} over {}",
                            delay,
                            tryCount,
                            maxRetries);
                    final Metronome metronome = Metronome.sleeper(delay, Clock.SYSTEM);
                    metronome.pause();
                }
            }
        }
    }

    @Override
    public void initConnection() throws SQLException, InterruptedException {
        // See https://www.postgresql.org/docs/current/logical-replication-quick-setup.html
        // For pgoutput specifically, the publication must be created before the slot.
        initPublication();
        if (!hasInitedSlot) {
            initReplicationSlot();

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Ensure a distinct slot.name per connector instance when multiple connectors target the same database host.
  2. Wait/retry — this is transient; if the previous owner is gone, the retry loop usually succeeds.
  3. Kill the stale backend streaming from the slot: SELECT pg_terminate_backend(active_pid) FROM pg_replication_slots WHERE slot_name='<slot>';
  4. Increase maxRetries/delay if the competing session legitimately takes long to release the slot.

Example fix

// before: two tasks on same host
{"slot.name": "my_slot"} // in both configs
// after
// task 1: {"slot.name": "my_slot_1"}
// task 2: {"slot.name": "my_slot_2"}
Defensive patterns

Strategy: retry

Validate before calling

SELECT active, active_pid FROM pg_replication_slots WHERE slot_name='<slot>'; -- ensure inactive before startStreaming

Try / catch

try { startStreaming(); } catch (DebeziumException e) { if (e.getMessage().contains("is active")) { backoffRetry(); } else { throw e; } }

Prevention

When it happens

Trigger: startStreaming -> createReplicationStream fails with a retryable PSQLException on each attempt; if the message matches 'replication slot .* is active', the exception also hints to use distinct slot names per connector.

Common situations: Two connectors streaming from the same replication slot; a previous connection to the slot not fully closed yet (failover/restart race); network blips between the JDBC replication connection and the server.

Related errors


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