Skip to content

[favorites] executor 线程泄漏 — list_with_status 默认 ThreadPoolExecutor 可能耗尽 #51

Description

@SymbolStar

Follow-up from PR #50 (judy review).

forge_favorites.list_with_statusasyncio.wait_for(loop.run_in_executor(None, os.stat)) + 100ms timeout。timeout 触发时 executor 那个 sync 线程继续阻塞在 stat 直到底层 syscall 返回(asyncio 没法 cancel 同步任务)。

极端场景:scott 50 条收藏全在 spin-down 盘上 → 50 个线程挂在默认 ThreadPoolExecutor 里 30s+,后续 GET 把 pool 耗光。当前 server 不是 asyncio HTTP,影响小,但可以:

  • 换专用 ThreadPoolExecutor(max_workers=N)
  • 或硬 timeout(cap 收藏总数 + 短路)

挂在 alice 的 backlog 里。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions