#5494·MinerU

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 助手咨询

Description of the bug | 错误描述

  • In mineru-api (mineru/cli/fast_api.py), AsyncTaskManager manages asynchronous parsing tasks and cleans up task output directories during runtime via cleanup_expired_tasks().
  • However, cleanup_expired_tasks() only iterates over tasks tracked in the in-memory self.tasks dictionary.
  • When the service restarts, crashes, or is redeployed, self.tasks in memory is reset to empty.
  • Any output directories created under output_root prior to the restart become orphaned: they are never tracked in memory again and therefore are never deleted by cleanup_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_root on startup and during the periodic background cleanup loop to remove expired orphan directories whose disk modification time exceeds task_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-api process.
  • 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