{"record":{"id":"ff07d46d944a0136","repo":"apache/seatunnel","slug":"failed-to-start-replication-stream-at-waiting","errorCode":null,"errorMessage":"Failed to start replication stream at {}, waiting for {} ms and retrying, attempt number {} over {}","messagePattern":"Failed to start replication stream at (.+?), waiting for (.+?) ms and retrying, attempt number (.+?) over (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-cdc/connector-cdc-opengauss/src/main/java/io/debezium/connector/postgresql/connection/PostgresReplicationConnection.java","lineNumber":417,"sourceCode":"            LOGGER.debug(\"starting streaming from LSN '{}'\", lsn);\n        }\n\n        final int maxRetries = connectorConfig.maxRetries();\n        final Duration delay = connectorConfig.retryDelay();\n        int tryCount = 0;\n        while (true) {\n            try {\n                return createReplicationStream(lsn, walPosition);\n            } catch (Exception e) {\n                String message = \"Failed to start replication stream at \" + lsn;\n                if (++tryCount > maxRetries) {\n                    if (e.getMessage().matches(\".*replication slot .* is active.*\")) {\n                        message +=\n                                \"; when setting up multiple connectors for the same database host, please make sure to use a distinct replication slot name for each.\";\n                    }\n                    throw new DebeziumException(message, e);\n                } else {\n                    LOGGER.warn(\n                            message + \", waiting for {} ms and retrying, attempt number {} over {}\",\n                            delay,\n                            tryCount,\n                            maxRetries);\n                    final Metronome metronome = Metronome.sleeper(delay, Clock.SYSTEM);\n                    metronome.pause();\n                }\n            }\n        }\n    }\n\n    @Override\n    public void initConnection() throws SQLException, InterruptedException {\n        // See https://www.postgresql.org/docs/current/logical-replication-quick-setup.html\n        // For pgoutput specifically, the publication must be created before the slot.\n        initPublication();\n        if (!hasInitedSlot) {\n            initReplicationSlot();","sourceCodeStart":399,"sourceCodeEnd":435,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-cdc/connector-cdc-opengauss/src/main/java/io/debezium/connector/postgresql/connection/PostgresReplicationConnection.java#L399-L435","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Ensure a distinct slot.name per connector instance when multiple connectors target the same database host.","Wait/retry — this is transient; if the previous owner is gone, the retry loop usually succeeds.","Kill the stale backend streaming from the slot: SELECT pg_terminate_backend(active_pid) FROM pg_replication_slots WHERE slot_name='<slot>';","Increase maxRetries/delay if the competing session legitimately takes long to release the slot."],"exampleFix":"// before: two tasks on same host\n{\"slot.name\": \"my_slot\"} // in both configs\n// after\n// task 1: {\"slot.name\": \"my_slot_1\"}\n// task 2: {\"slot.name\": \"my_slot_2\"}","handlingStrategy":"retry","validationCode":"SELECT active, active_pid FROM pg_replication_slots WHERE slot_name='<slot>'; -- ensure inactive before startStreaming","typeGuard":null,"tryCatchPattern":"try { startStreaming(); } catch (DebeziumException e) { if (e.getMessage().contains(\"is active\")) { backoffRetry(); } else { throw e; } }","preventionTips":["Unique slot.name per connector/host.","Cleanly stop old connectors before starting new ones.","Set sane retry delay/maxRetries for restart storms."],"tags":["cdc","postgresql","replication","retry"],"backgroundTag":"address-already-in-use","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}