Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta
#1,148 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
c

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
C
Stelle
3
Fork
7
Merge medio
4h 15m
PR unite (30g)
106

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di InauguralSystems/EigenScript

Tutte le issue di InauguralSystems/EigenScript

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.