Concurrency: "messages copy" is false for buffer, text_builder and closures — shared by reference through send and thread_join, with a real data race between sender and receiver
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- c
调研方向
Run the probe files under ~/src/wt/briefs/conc-review/probes-{A,B,C}/ and reproduce the race with TSan. Read chan_clone_rec in src/eigenscript.c:2235-2308, its send/thread_entry callers, and the buffer operations in builtins_buf.c:116-148. Done means the reported sharing and race are resolved, with the aliasing, depth-cutoff, and closure behavior documented in docs/CONCURRENCY.md.
由索引模型根据 Issue 内容生成。
描述
Found by the 2026-09-14 whole-runtime concurrency review (three independent reviewers, every finding below reproduced by execution on main @ a18deac unless marked reading). Probe files live in ~/src/wt/briefs/conc-review/probes-{A,B,C}/.
docs/CONCURRENCY.md: "A value sent through a channel, or returned through thread_join, is COPIED … share-nothing". chan_clone_rec (src/eigenscript.c:2302-2308) shares VAL_FN/VAL_BUILTIN/VAL_BUFFER/VAL_TEXT_BUILDER/VAL_JSON_RAW by refcount (used by send :4711, thread_entry :4484, task_spawn :4940). Only a C comment says so.
Observed
c is channel of 4
b is buffer of 4
buf_set of [b, 0, 1.5]
send of [c, b]
buf_set of [b, 0, 99.0]
got is recv of c
print of f"buffer recv[0] after post-send mutation (expect 1.5): {buf_get of [got, 0]}"
tb is text_builder_new of []
text_builder_append of [tb, "before"]
send of [c, tb]
text_builder_append of [tb, "+AFTER"]
got2 is recv of c
print of f"text_builder recv (expect 'before'): {text_builder_to_string of got2}"
buffer recv[0] after post-send mutation (expect 1.5): 99
text_builder recv (expect 'before'): before+AFTER
dict.buffer recv[0] (expect 99 if copied at send): -7 # nested in a dict: same
A closure sent inside a dict still mutates the sender's captured list (101) while the sibling list in the same dict was copied ([0]). With the receiver reading while the sender writes, TSan reports the data race the doc promises cannot exist: builtin_buf_set builtins_buf.c:148 (main) vs builtin_buf_get :116 (T1). Note also that copies split internal aliasing (a joined [d, inner] with d.xs IS inner comes back as two independent lists) and the depth-64 cutoff in chan_clone_rec :2257 falls back to sharing (reading).
Fix direction
memcpy-clone buffers and text builders in chan_clone_rec (they are flat); document that functions are shared by reference and what that implies for their captured state (with the :2235-2236 caveat); document the aliasing split and the depth cutoff, or make the clone alias-preserving.
- 主要语言
- C
- 星标
- 3
- 派生
- 7
- 平均合并
- 4 小时 5 分钟
- 30 天内合并 PR
- 116
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
InauguralSystems/EigenScript 的其他 Issue
-
area:docs good first issue kind:docs-drift
难度 1/5 1 小时以内 新手友好度 92/100
InauguralSystems/EigenScript#1400 ·
维护者通常 1 天内回复
-
area:docs good first issue kind:docs-drift
难度 2/5 1-3 小时 新手友好度 90/100
InauguralSystems/EigenScript#1396 ·
维护者通常 1 天内回复
-
docs/BUILTINS.md: task_spawn row says task_yield/task_join 'land in a later increment'; both exist未关闭area:docs good first issue kind:docs-drift
难度 2/5 1-3 小时 新手友好度 88/100
InauguralSystems/EigenScript#1392 ·
维护者通常 1 天内回复
-
area:embed kind:silent-wrong
难度 2/5 1-3 小时 新手友好度 78/100
InauguralSystems/EigenScript#1387 ·
维护者通常 1 天内回复
-
area:stdlib kind:silent-wrong
难度 2/5 1-3 小时 新手友好度 86/100
InauguralSystems/EigenScript#1378 ·
维护者通常 1 天内回复
查看 InauguralSystems/EigenScript 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
trezor/trezor-firmware#7997 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
area/ysql kind/bug priority/medium status/awaiting-triage
难度 2/5 1-3 小时 新手友好度 84/100
yugabyte/yugabyte-db#34415 ·
维护者通常 1 天内回复
-
难度 1/5 1-3 小时 新手友好度 78/100
KhronosGroup/OpenCL-Headers#318 ·
-
0.kind: build failure
难度 2/5 1-3 小时 新手友好度 73/100
维护者通常 1 天内回复