当 Worker 执行重任务时,`CommonTaskTracker` 的定时线程正在访问 `DbTaskPersistenceService`/H2 数据库。如果此时触发 `HeavyTaskTracker.destroy()`,其中会对 `scheduledPool` 执行 `shutdownNow()`,可能会中断正在执行 H2 SQL 的线程,导致 H2 数据库关闭或文件异常。
作者: imzhonghua创建于 2026年6月12日更新于 2026年6月12日
标签bug
Problem Description
When the Worker is executing a heavy task, the timer thread of the CommonTaskTracker is accessing the DbTaskPersistenceService/H2 database. If the HeavyTaskTracker.destroy() is triggered at this time, which calls shutdownNow() on the scheduledPool, it may interrupt the thread that is executing the H2 SQL.
Since the H2 backend uses the FileChannel/MVStore, the interruption of the thread may cause the underlying FileChannel to be closed, resulting in:
内容来源: PowerJob/PowerJob