alibaba/canal · error · CanalClientException

failed to ack after

Error message

failed to ack after 

What it means

Error "failed to ack after " thrown in alibaba/canal.

Source

Thrown at client/src/main/java/com/alibaba/otter/canal/client/impl/ClusterCanalConnector.java:275

    }

    @Override
    public void ack(long batchId) throws CanalClientException {
        int times = 0;
        while (times < retryTimes) {
            try {
                currentConnector.ack(batchId);
                return;
            } catch (Throwable t) {
                logger.warn(String.format("something goes wrong when acking data from server:%s",
                    currentConnector != null ? currentConnector.getAddress() : "null"), t);
                times++;
                restart();
                logger.info("restart the connector for next round retry.");
            }
        }

        throw new CanalClientException("failed to ack after " + times + " times retry");
    }

    private void restart() throws CanalClientException {
        disconnect();
        try {
            Thread.sleep(retryInterval);
        } catch (InterruptedException e) {
            throw new CanalClientException(e);
        }
        connect();
    }

    // ============================= setter / getter
    // ============================

    public String getUsername() {
        return username;
    }

View on GitHub (pinned to 87be50e876)

Solutions

  1. Ensure the batchId passed to ack() matches one returned by getWithoutAck and has not been acked already.
  2. If the connector failed over to a standby canal server, re-subscribe and re-fetch instead of acking the old batchId.
  3. Catch CanalClientException around ack() and retry with backoff, or restart the consumer to resume from the last confirmed position.

When it happens

Trigger: Thrown at client/src/main/java/com/alibaba/otter/canal/client/impl/ClusterCanalConnector.java:275 when the library encounters an invalid state.

Common situations: Ack failure after get. Retry the ack on the next available node with the same batchId, and treat repeated failure as data-loss risk requiring reconciliation from the last confirmed position.


AI-assisted analysis of alibaba/canal@87be50e876 (2026-08-14). Data as JSON: /api/errors/7e4d2d7fc5b31f90. Report an issue: GitHub.