{"record":{"id":"3db1df7a52b62722","repo":"alibaba/canal","slug":"null-zookeeperlogpositionmanager","errorCode":null,"errorMessage":"null zooKeeperLogPositionManager","messagePattern":"null zooKeeperLogPositionManager","errorType":"validation","errorClass":"NullPointerException","httpStatus":null,"severity":"error","filePath":"parse/src/main/java/com/alibaba/otter/canal/parse/index/PeriodMixedLogPositionManager.java","lineNumber":43,"sourceCode":"    private MemoryLogPositionManager    memoryLogPositionManager;\n    private ZooKeeperLogPositionManager zooKeeperLogPositionManager;\n    private ScheduledExecutorService    executorService;\n\n    private long                        period;\n    private Set<String>                 persistTasks;\n\n    @SuppressWarnings(\"serial\")\n    private final LogPosition           nullPosition = new LogPosition() {\n                                                     };\n\n    public PeriodMixedLogPositionManager(MemoryLogPositionManager memoryLogPositionManager,\n                                         ZooKeeperLogPositionManager zooKeeperLogPositionManager, long period){\n        if (memoryLogPositionManager == null) {\n            throw new NullPointerException(\"null memoryLogPositionManager\");\n        }\n\n        if (zooKeeperLogPositionManager == null) {\n            throw new NullPointerException(\"null zooKeeperLogPositionManager\");\n        }\n\n        if (period <= 0) {\n            throw new IllegalArgumentException(\"period must be positive, given: \" + period);\n        }\n\n        this.memoryLogPositionManager = memoryLogPositionManager;\n        this.zooKeeperLogPositionManager = zooKeeperLogPositionManager;\n        this.period = period;\n        this.persistTasks = Collections.synchronizedSet(new HashSet<>());\n        this.executorService = Executors.newScheduledThreadPool(1);\n    }\n\n    @Override\n    public void stop() {\n        super.stop();\n\n        if (zooKeeperLogPositionManager.isStart()) {","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/alibaba/canal/blob/87be50e87686a3e8af08c368d0e1ffd1f59eb04a/parse/src/main/java/com/alibaba/otter/canal/parse/index/PeriodMixedLogPositionManager.java#L25-L61","documentation":"PeriodMixedLogPositionManager requires a ZooKeeperLogPositionManager as its durable delegate. A null value throws NullPointerException at construction because there is no durable backend to flush to.","triggerScenarios":"Constructing PeriodMixedLogPositionManager with zooKeeperLogPositionManager == null. This happens when the ZooKeeperLogPositionManager was not built (e.g. zkClient was null upstream) or was injected incorrectly.","commonSituations":"The zkClient is unset so ZooKeeperLogPositionManager was never constructed; Spring property binding wired the wrong bean; a refactor changed the constructor signature.","solutions":["Build a non-null ZooKeeperLogPositionManager from a valid zkClient and pass it as the second argument.","Ensure the underlying ZkClientx is created (canal.zkServers set) so the zk manager is non-null.","Verify constructor argument order: (memory, zooKeeper, period)."],"exampleFix":"// before\nnew PeriodMixedLogPositionManager(memMgr, null, period);\n\n// after\nZooKeeperLogPositionManager zkMgr = new ZooKeeperLogPositionManager(zk);\nnew PeriodMixedLogPositionManager(memMgr, zkMgr, period);","handlingStrategy":"validation","validationCode":"ZooKeeperLogPositionManager zk = Objects.requireNonNull(zkMgr, \"zooKeeperLogPositionManager\");\nnew PeriodMixedLogPositionManager(memMgr, zk, period);","typeGuard":"boolean hasZkManager(ZooKeeperLogPositionManager z) { return z != null; }","tryCatchPattern":null,"preventionTips":["Build ZooKeeperLogPositionManager from a non-null zkClient first.","Verify argument order: (memory, zooKeeper, period)."],"tags":["canal","log-position-manager","null-check","zookeeper","configuration"],"backgroundTag":null,"analyzedSha":"87be50e87686a3e8af08c368d0e1ffd1f59eb04a","analyzedAt":"2026-08-14T04:30:11.918Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}