Skip to content

[Bug] 并发下场景下skill执行目录有概率被清空 #6185

@2710165659

Description

@2710165659

Contact Information

No response

MaxKB Version

2.9.2

Problem Description

并发请求下,skill/MCP tool 执行时解压到 /tmp 的沙箱目录会被意外清空,导致执行失败。

Steps to Reproduce

  1. 创建两个应用一个挂载耗时较长的skill,一个挂载任意skill/mcp/tool,保存并发布
  2. 发布页同时或4秒内分别下达两个任务,一个耗时长,一个耗时短
  3. 耗时短的任务执行完成时会清理/tmp/chat_id[:8]目录
  4. 耗时长的任务会报错,找不到/tmp目录下文件,通过ls也列不出任何文件

The expected correct result

每个请求应有独立的临时目录,互不干扰。skill 执行过程中目录不应被其他请求清理。

Related log output

Additional Information

可能的原因:
对话使用 uuid.uuid1() 生成 chat_id,UUID v1 前 8 位是时间戳低 32 位,每 ~4.3 秒才变化一次。4.3 秒内创建的不同对话 chat_id[:8] 必然相同,共享同一目录,互相踩踏。

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions