Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

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

Open
#1,148 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
c

Research direction

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.

Written by the indexing model from the issue text.

Description

area:concurrency kind:silent-wrong

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.

Dominant language
C
Stars
3
Forks
7
Avg merge
4h 15m
Merged PRs (30d)
106

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

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 InauguralSystems/EigenScript

All issues in InauguralSystems/EigenScript

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.