开发者社区> 问答> 正文

canal-server-1.1.6 客户端重连次数过多后报 connection refused

使用 docker 部署的 canal-server-1.1.6,客户端调度过程中遇到错误断开重连,重连次数过多后连接到 canal-server 的时候报连接拒绝 (java.net.ConnectException: Connection refused: connect) 错误。

try { message = connector.getWithoutAck(batchSize); // 获取指定数量的数据 } catch (CanalClientException | NullPointerException e) { log.warn("Get messages failed, reconnect to canal server.", e);

connector.disconnect();
connectCanal();
return;

}

重连是因为每隔一段时间就会因为 batchId 错误导致反序列化失败。

com.alibaba.otter.canal.protocol.exception.CanalClientException: deserializer failed at com.alibaba.otter.canal.client.CanalMessageDeserializer.deserializer(CanalMessageDeserializer.java:54) ~[canal.client-1.1.6.jar:?] at com.alibaba.otter.canal.client.impl.SimpleCanalConnector.receiveMessages(SimpleCanalConnector.java:340) ~[canal.client-1.1.6.jar:?] at com.alibaba.otter.canal.client.impl.SimpleCanalConnector.getWithoutAck(SimpleCanalConnector.java:332) ~[canal.client-1.1.6.jar:?] at com.alibaba.otter.canal.client.impl.SimpleCanalConnector.getWithoutAck(SimpleCanalConnector.java:303) ~[canal.client-1.1.6.jar:?] at com.changhongedu.sccp.syncd.service.SyncdService.doSync(SyncdService.java:117) ~[classes/:?] at org.springframework.cloud.sleuth.instrument.async.TraceRunnable.run(TraceRunnable.java:64) ~[spring-cloud-sleuth-instrumentation-3.1.2.jar:3.1.2] at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) ~[spring-context-5.3.19.jar:5.3.19] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[?:?] at java.util.concurrent.FutureTask.runAndReset$$$capture(FutureTask.java:305) ~[?:?] at java.util.concurrent.FutureTask.runAndReset(FutureTask.java) ~[?:?] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) ~[?:?] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[?:?] at java.lang.Thread.run(Thread.java:829) ~[?:?] Caused by: com.alibaba.otter.canal.protocol.exception.CanalClientException: something goes wrong with reason: something goes wrong with channel:[id: 0x149f2f1a, /192.168.33.12:55963 => /172.17.0.5:11111], exception=com.alibaba.otter.canal.meta.exception.CanalMetaManagerException: batchId:3488 is not the firstly:3486

at com.alibaba.otter.canal.client.CanalMessageDeserializer.deserializer(CanalMessageDeserializer.java:46) ~[canal.client-1.1.6.jar:?]
... 13 more

docker 镜像回退到 canal-server-1.1.5 ,虽然还是会每隔一段时间就会因为 batchId 错误导致反序列化失败,但是客户端可以正常重新连接上 canal-server 。

原提问者GitHub用户JaynLa

展开
收起
白夜行fighting 2023-04-25 20:35:24 225 0
1 条回答
写回答
取消 提交回答
  • batchId:3488 is not the firstly:3486,乱序ack

    原回答者GitHub用户agapple

    2023-04-26 17:22:31
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载