同步关闭,某些情况下资源没有释放,导致重启同步时报错Received error packet: errno = 1236, sqlstate = HY000 errmsg = A
- Dominant language
- Java
- Stars
- 8.1k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Description
Mysql版本:5.6.34
Otter版本:4.2.14。开启监控但是没有开启心跳
运行一段时间后出现异常:

怀疑是使用相同的SlaveId去请求Mysql Dump了。从Java的dump文件看会出现同一个同步有两个正在运行的MysqlEventParser。

截图中的#1和#3这两个实例的running都是=true,并且#3已经没有被

引用了,并且AbstractCanalInstance中的其他一些对象,比如CanalEventSink、CanalMetaManager也有这种情况,不知道是不是某些情况没有调用stop方法。
另外Canal在没有开启心跳的情况下,MysqlEventParser的stopHeartBeat方法会报类型转换错误。需要加一个判断条件:

Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing shutdown and restart handling around MysqlEventParser and AbstractCanalInstance, focusing on the running instances and referenced CanalEventSink and CanalMetaManager objects shown in the dump. Check the MysqlEventParser.stopHeartBeat path when heartbeat is disabled. Done means shutdown releases the old parser and related objects, restart does not reuse conflicting state, and stopHeartBeat avoids the reported type-conversion error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, mysql
- Domain
- databases, distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100