Bug: Orphan task output directories are not cleaned up after server restart
Author: hsiongCreated Sep 15, 2026Updated Sep 15, 2026
Labelsbug
Search before asking | 提交之前请先搜索
- I have searched the MinerU Readme and found no similar bug report.
- I have searched the MinerU Issues and found no similar bug report.
- I have searched the MinerU Discussions and found no similar bug report.
Consult the online AI assistant for assistance | 在线 AI 助手咨询
- I have consulted the online AI assistant but was unable to obtain a solution to the issue.
Description of the bug | 错误描述
- In
mineru-api(mineru/cli/fast_api.py),AsyncTaskManagermanages asynchronous parsing tasks and cleans up task output directories during runtime viacleanup_expired_tasks(). - However,
cleanup_expired_tasks()only iterates over tasks tracked in the in-memoryself.tasksdictionary. - When the service restarts, crashes, or is redeployed,
self.tasksin memory is reset to empty. - Any output directories created under
output_rootprior to the restart become orphaned: they are never tracked in memory again and therefore are never deleted bycleanup_expired_tasks(). - Over time, these orphaned directories accumulate permanently on the file system, causing serious disk space leaks in production environments.
- Expected behavior: The service should scan
output_rooton startup and during the periodic background cleanup loop to remove expired orphan directories whose disk modification time exceedstask_retention_seconds.
How to reproduce the bug | 如何复现
- Start the FastAPI service via
mineru-api. - Submit one or more asynchronous parsing tasks so that task output directories are created under the output root directory.
- Terminate or restart the
mineru-apiprocess. - Restart the service and wait longer than
task_retention_seconds. - Check the output root directory on disk; the previous task output folders still persist indefinitely.
Operating System Mode | 操作系统类型
Linux
Operating System Version| 操作系统版本
Linux Mint 22.3
Python version | Python 版本
3.12
Software version | 软件版本 (mineru --version)
>=2.5
Backend name | 解析后端
vlm
Device mode | 设备模式
cuda
Source: opendatalab/MinerU