Repository navigation
Conversation
…r not handled 修复 convert.go 中 convertToFloat64/convertToInt64/convertToString 遗漏 json.Number 类型处理导致 Number/Integer 字段被置 null 的问题。 问题现象: 代码节点输出声明为 Number/Integer 类型的字段,在代码正确返回数字时, 节点输出被置为 null,并报错 "field xxx is not number"。 根因: 代码运行结果经 sonic UseNumber() 反序列化后产生 json.Number 类型 (type Number string),而 convertToFloat64/convertToInt64 的 type switch 只处理了 int64/float64/string,未处理 json.Number,导致走到 default 分支 生成 warning 并将字段置 null。 修复: 在 convertToFloat64/convertToInt64/convertToString 三个函数中新增 json.Number case,分别调用 .Float64()/.Int64()/.String() 转换。 详见 BUGFIX-json-number-convert.md
…pipes Cancel only set a Redis flag while exec.Command ignored ctx, so Deno kept the ExtraFiles pipes open and the code node stayed hung. Co-authored-by: Cursor <cursoragent@cursor.com>
…aths Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
修复工作流代码节点两类问题:
os.Pipe()两端不关,抽视频等代码节点假死,最长拖到CODE_RUNNER_TIMEOUT_SECONDS默认 600 秒。null,并报field xxx is not number。根因都在 wanwu-workflow 引擎(镜像
workflow-wanwu),不在万悟主仓 BFF/前端,也不在社创run_by_wanwu协议。问题 1:取消杀不掉沙箱,pipe 泄漏
现象
POST /v1/workflow/run_by_wanwu进入引擎后,代码节点走sandbox/runner.go→sandbox.py→ Deno/Pyodide。get_process长时间仍是 Running。python sandbox.py/deno残留,父进程挂着 4 个 pipe 端。根因
Run()使用exec.Command,不听ctx。workflow:cancel:status:{exeID},事件循环cancelFn()后图的ctx被取消,但沙箱阻塞在json.Decode,OnError收不到context.Canceled。Start后不关多余 pipe;错误路径不 Kill/Wait/Close。sandbox.py用subprocess.run,超时只杀 Deno 一层;请求读端不关。修复
sandbox/runner.go:CommandContext+Setpgid;ctx.Done()时SIGKILL整个进程组;Decode放入select;所有路径 Kill + Wait + Close。sandbox.py:Popen+setsid+PR_SET_PDEATHSIG;超时/异常os.killpg;finally关闭 fd 3/4。code/code.go:context.Canceled/DeadlineExceeded不再包成执行失败,便于get_process记为 Cancel。问题 2:Number/Integer 输出被置 null
现象
代码节点输出类型为 Number/Integer 时,代码已正确返回数字,节点输出仍为
null,并出现field xxx is not number。根因
运行结果经
UseNumber()反序列化后是json.Number(底层为string)。convertToFloat64/convertToInt64/convertToString的 type switch 未处理该类型,落入 default,生成 warning 并把字段置空。修复
三个转换函数增加
json.Number分支,分别调用.Float64()/.Int64()/.String()。说明见BUGFIX-json-number-convert.md。变更文件
backend/infra/coderunner/impl/sandbox/runner.gobackend/infra/coderunner/impl/script/sandbox.pybackend/domain/workflow/internal/nodes/code/code.gobackend/domain/workflow/internal/nodes/convert.gojson.Number转换BUGFIX-json-number-convert.md影响范围
wanwu无需为漏 fd 改业务代码。workflow-wanwu镜像并重启该容器后生效。Test plan
get_process在数秒内变为 Cancel,而不是再挂满 10 分钟。python sandbox.py/deno;引擎进程 fd 中无多余 pipe。null,不再报field xxx is not number。Commits
144daddafix(workflow): code node Number/Integer output null due to json.Number not handleda385e82efix(workflow): kill sandbox process group on cancel and close leaked pipes