后台常驻实例会留下不退出副本(inbox --no-open)

Open
#3,350 5 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
1-2 days
Newbie friendliness
30/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
typescript
Domain
cli

Research direction

Start with the plannotator inbox startup path and the plannotator inbox status reporting code, since the issue is about instance lifecycle and what status lists. Reproduce by launching several inbox --no-open processes at once, then check whether each one honours PLANNOTATOR_PORT and PLANNOTATOR_DATA_DIR. Done means orphaned background instances either exit or are reported by status, with a test covering the concurrent-start case. The cause is still unverified, so confirm it before choosing between a file lock and idle exit.

Written by the indexing model from the issue text.

Description

环境:macOS 27.0.1 (26A434);Plannotator 0.28.64;服务运行在 127.0.0.1:65176

现象:plannotator inbox status 报告只有一份在跑(pid 55438,占 634 MB)。但同一时刻机器上还有 3 个 plannotator inbox --no-open 进程:

pid 内存 启动时间 父进程
13200 121 MB 00:34 1
88476 119 MB 00:32 1
78796 118 MB 01:02 1

三个的命令行和正在服务的那份完全相同,父进程都已经是 1,也就是说拉起它们的进程早就退了,它们自己没退。它们也不出现在 status 的输出里。

复现尝试没成功:我试着在已有实例运行时再启动一个 inbox --no-open,它打印出 URL 后 3 秒内以退出码 0 结束,行为是对的。所以"第二个实例会挂住"这条路径并不成立。

因此来源未定。 可能的几条(都还没验证):

  1. 启动竞态:同一时刻有多个调用,各自判断"没有实例在跑",于是都去启动,之后协调失败但没有退出。
  2. 不同的 PLANNOTATOR_PORT 或 PLANNOTATOR_DATA_DIR:那样它们会是合法的独立实例,只是 status 只显示其中一个。
  3. 启动过程中被信号打断,留下的半启动状态。

我先关掉才想到要查它们各自的端口和数据目录,所以这两项没留下证据。

影响:每份约占 120 MB,且不会自己退出,会一直累积。

建议

  1. 启动时用文件锁串行化,避免竞态。
  2. 把所有后台实例的 pid、端口、数据目录记下来,status 能一次列全,便于发现残留。
  3. 给后台实例加空闲退出:一段时间没有连接就自己结束。
Dominant language
TypeScript
Stars
8.7k
Forks
649
Avg merge
16h 1m
Merged PRs (30d)
756

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from backnotprop/plannotator

All issues in backnotprop/plannotator

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.